Add SPI for setting media cache and key location on _WKWebsiteDataStoreConfiguration
[WebKit-https.git] / Tools / TestWebKitAPI / TCPServer.cpp
1 /*
2  * Copyright (C) 2019 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "TCPServer.h"
28
29 #include <netinet/in.h>
30 #include <thread>
31 #include <unistd.h>
32 #include <wtf/Optional.h>
33 #include <wtf/text/Base64.h>
34
35 #if HAVE(SSL)
36 extern "C" {
37
38 struct BIO;
39 struct X509;
40 struct SSL_CTX;
41 struct EVP_PKEY;
42 struct SSL_METHOD;
43 struct X509_STORE_CTX {
44     void* unused;
45     X509* cert;
46 };
47 struct pem_password_cb;
48 int BIO_free(BIO*);
49 int SSL_free(SSL*);
50 int X509_free(X509*);
51 int SSL_CTX_free(SSL_CTX*);
52 int EVP_PKEY_free(EVP_PKEY*);
53 int SSL_library_init();
54 const SSL_METHOD* SSLv23_server_method();
55 BIO* BIO_new_mem_buf(const void*, int);
56 X509* PEM_read_bio_X509(BIO*, X509**, pem_password_cb*, void*);
57 EVP_PKEY* PEM_read_bio_PrivateKey(BIO*, EVP_PKEY**, pem_password_cb*, void*);
58 SSL_CTX* SSL_CTX_new(const SSL_METHOD*);
59 const SSL_METHOD* SSLv23_server_method();
60 int SSL_CTX_use_certificate(SSL_CTX*, X509*);
61 int SSL_CTX_use_PrivateKey(SSL_CTX*, EVP_PKEY*);
62 SSL* SSL_new(SSL_CTX*);
63 int SSL_accept(SSL*);
64 int SSL_set_fd(SSL*, int);
65 void SSL_CTX_set_verify(SSL_CTX*, int, int (*)(int, X509_STORE_CTX*));
66 void SSL_CTX_set_cert_verify_callback(SSL_CTX*, int (*)(X509_STORE_CTX*, void*), void*);
67 int SSL_get_error(const SSL*, int);
68 int SSL_read(SSL*, void*, int);
69 int SSL_write(SSL*, const void*, int);
70 int i2d_X509(X509*, unsigned char**);
71 void OPENSSL_free(void*);
72 #define SSL_VERIFY_PEER 0x01
73 #define SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x02
74
75 } // extern "C"
76 #endif // HAVE(SSL)
77
78 namespace TestWebKitAPI {
79
80 #if HAVE(SSL)
81 template<typename> struct deleter;
82 template<> struct deleter<BIO> {
83     void operator()(BIO* bio)
84     {
85         BIO_free(bio);
86     }
87 };
88 template<> struct deleter<SSL> {
89     void operator()(SSL* ssl)
90     {
91         SSL_free(ssl);
92     }
93 };
94 template<> struct deleter<X509> {
95     void operator()(X509* x509)
96     {
97         X509_free(x509);
98     }
99 };
100 template<> struct deleter<SSL_CTX> {
101     void operator()(SSL_CTX* ctx)
102     {
103         SSL_CTX_free(ctx);
104     }
105 };
106 template<> struct deleter<EVP_PKEY> {
107     void operator()(EVP_PKEY* key)
108     {
109         EVP_PKEY_free(key);
110     }
111 };
112 template<> struct deleter<uint8_t[]> {
113     void operator()(uint8_t* buffer)
114     {
115         OPENSSL_free(buffer);
116     }
117 };
118 #endif // HAVE(SSL)
119
120 TCPServer::TCPServer(Function<void(Socket)>&& connectionHandler, size_t connections)
121     : m_connectionHandler(WTFMove(connectionHandler))
122 {
123     listenForConnections(connections);
124 }
125
126 #if HAVE(SSL)
127 TCPServer::TCPServer(Protocol protocol, Function<void(SSL*)>&& secureConnectionHandler)
128 {
129     auto startSecureConnection = [secureConnectionHandler = WTFMove(secureConnectionHandler), protocol] (Socket socket) {
130         SSL_library_init();
131
132         std::unique_ptr<SSL_CTX, deleter<SSL_CTX>> ctx(SSL_CTX_new(SSLv23_server_method()));
133
134         // This is a test certificate from BoringSSL.
135         char kCertPEM[] =
136         "-----BEGIN CERTIFICATE-----\n"
137         "MIICWDCCAcGgAwIBAgIJAPuwTC6rEJsMMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV\n"
138         "BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX\n"
139         "aWRnaXRzIFB0eSBMdGQwHhcNMTQwNDIzMjA1MDQwWhcNMTcwNDIyMjA1MDQwWjBF\n"
140         "MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50\n"
141         "ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB\n"
142         "gQDYK8imMuRi/03z0K1Zi0WnvfFHvwlYeyK9Na6XJYaUoIDAtB92kWdGMdAQhLci\n"
143         "HnAjkXLI6W15OoV3gA/ElRZ1xUpxTMhjP6PyY5wqT5r6y8FxbiiFKKAnHmUcrgfV\n"
144         "W28tQ+0rkLGMryRtrukXOgXBv7gcrmU7G1jC2a7WqmeI8QIDAQABo1AwTjAdBgNV\n"
145         "HQ4EFgQUi3XVrMsIvg4fZbf6Vr5sp3Xaha8wHwYDVR0jBBgwFoAUi3XVrMsIvg4f\n"
146         "Zbf6Vr5sp3Xaha8wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA76Hht\n"
147         "ldY9avcTGSwbwoiuIqv0jTL1fHFnzy3RHMLDh+Lpvolc5DSrSJHCP5WuK0eeJXhr\n"
148         "T5oQpHL9z/cCDLAKCKRa4uV0fhEdOWBqyR9p8y5jJtye72t6CuFUV5iqcpF4BH4f\n"
149         "j2VNHwsSrJwkD4QUGlUtH7vwnQmyCFxZMmWAJg==\n"
150         "-----END CERTIFICATE-----\n";
151
152         std::unique_ptr<BIO, deleter<BIO>> certBIO(BIO_new_mem_buf(kCertPEM, strlen(kCertPEM)));
153         std::unique_ptr<X509, deleter<X509>> certX509(PEM_read_bio_X509(certBIO.get(), nullptr, nullptr, nullptr));
154         ASSERT(certX509);
155         SSL_CTX_use_certificate(ctx.get(), certX509.get());
156
157         if (protocol == Protocol::HTTPSWithClientCertificateRequest) {
158             SSL_CTX_set_verify(ctx.get(), SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr);
159             SSL_CTX_set_cert_verify_callback(ctx.get(), [] (X509_STORE_CTX* store_ctx, void*) -> int {
160                 uint8_t* bufferPointer = nullptr;
161                 auto length = i2d_X509(store_ctx->cert, &bufferPointer);
162                 std::unique_ptr<uint8_t[], deleter<uint8_t[]>> buffer(bufferPointer);
163                 auto expectedCert = testCertificate();
164                 EXPECT_EQ(static_cast<int>(expectedCert.size()), length);
165                 for (int i = 0; i < length; ++i)
166                     EXPECT_EQ(buffer.get()[i], expectedCert[i]);
167                 return 1;
168             }, nullptr);
169         }
170
171         // This is a test key from BoringSSL.
172         char kKeyPEM[] =
173         "-----BEGIN RSA PRIVATE KEY-----\n"
174         "MIICXgIBAAKBgQDYK8imMuRi/03z0K1Zi0WnvfFHvwlYeyK9Na6XJYaUoIDAtB92\n"
175         "kWdGMdAQhLciHnAjkXLI6W15OoV3gA/ElRZ1xUpxTMhjP6PyY5wqT5r6y8FxbiiF\n"
176         "KKAnHmUcrgfVW28tQ+0rkLGMryRtrukXOgXBv7gcrmU7G1jC2a7WqmeI8QIDAQAB\n"
177         "AoGBAIBy09Fd4DOq/Ijp8HeKuCMKTHqTW1xGHshLQ6jwVV2vWZIn9aIgmDsvkjCe\n"
178         "i6ssZvnbjVcwzSoByhjN8ZCf/i15HECWDFFh6gt0P5z0MnChwzZmvatV/FXCT0j+\n"
179         "WmGNB/gkehKjGXLLcjTb6dRYVJSCZhVuOLLcbWIV10gggJQBAkEA8S8sGe4ezyyZ\n"
180         "m4e9r95g6s43kPqtj5rewTsUxt+2n4eVodD+ZUlCULWVNAFLkYRTBCASlSrm9Xhj\n"
181         "QpmWAHJUkQJBAOVzQdFUaewLtdOJoPCtpYoY1zd22eae8TQEmpGOR11L6kbxLQsk\n"
182         "aMly/DOnOaa82tqAGTdqDEZgSNmCeKKknmECQAvpnY8GUOVAubGR6c+W90iBuQLj\n"
183         "LtFp/9ihd2w/PoDwrHZaoUYVcT4VSfJQog/k7kjE4MYXYWL8eEKg3WTWQNECQQDk\n"
184         "104Wi91Umd1PzF0ijd2jXOERJU1wEKe6XLkYYNHWQAe5l4J4MWj9OdxFXAxIuuR/\n"
185         "tfDwbqkta4xcux67//khAkEAvvRXLHTaa6VFzTaiiO8SaFsHV3lQyXOtMrBpB5jd\n"
186         "moZWgjHvB2W9Ckn7sDqsPB+U2tyX0joDdQEyuiMECDY8oQ==\n"
187         "-----END RSA PRIVATE KEY-----\n";
188
189         std::unique_ptr<BIO, deleter<BIO>> privateKeyBIO(BIO_new_mem_buf(kKeyPEM, strlen(kKeyPEM)));
190         std::unique_ptr<EVP_PKEY, deleter<EVP_PKEY>> privateKey(PEM_read_bio_PrivateKey(privateKeyBIO.get(), nullptr, nullptr, nullptr));
191         ASSERT(privateKey);
192         SSL_CTX_use_PrivateKey(ctx.get(), privateKey.get());
193
194         std::unique_ptr<SSL, deleter<SSL>> ssl(SSL_new(ctx.get()));
195         ASSERT(ssl);
196         SSL_set_fd(ssl.get(), socket);
197
198         auto acceptResult = SSL_accept(ssl.get());
199         ASSERT_UNUSED(acceptResult, acceptResult > 0);
200         
201         secureConnectionHandler(ssl.get());
202     };
203
204     switch (protocol) {
205     case Protocol::HTTPS:
206     case Protocol::HTTPSWithClientCertificateRequest:
207         m_connectionHandler = WTFMove(startSecureConnection);
208         break;
209     case Protocol::HTTPSProxy:
210         m_connectionHandler = [startSecureConnection = WTFMove(startSecureConnection)] (Socket socket) {
211             char readBuffer[1000];
212             auto bytesRead = ::read(socket, readBuffer, sizeof(readBuffer));
213             EXPECT_GT(bytesRead, 0);
214             EXPECT_TRUE(static_cast<size_t>(bytesRead) < sizeof(readBuffer));
215             
216             const char* responseHeader = ""
217             "HTTP/1.1 200 Connection Established\r\n"
218             "Connection: close\r\n\r\n";
219             auto bytesWritten = ::write(socket, responseHeader, strlen(responseHeader));
220             EXPECT_EQ(static_cast<size_t>(bytesWritten), strlen(responseHeader));
221             startSecureConnection(socket);
222         };
223         break;
224     }
225     listenForConnections(1);
226 }
227 #endif // HAVE(SSL)
228
229 void TCPServer::listenForConnections(size_t connections)
230 {
231     auto listeningSocket = socketBindListen(connections);
232     ASSERT(listeningSocket);
233     m_listeningThread = std::thread([this, listeningSocket = *listeningSocket, connections] {
234         for (size_t i = 0; i < connections; ++i) {
235             Socket connectionSocket = accept(listeningSocket, nullptr, nullptr);
236             m_connectionThreads.append(std::thread([this, connectionSocket] {
237                 m_connectionHandler(connectionSocket);
238                 shutdown(connectionSocket, SHUT_RDWR);
239                 close(connectionSocket);
240             }));
241         }
242     });
243 }
244
245 TCPServer::~TCPServer()
246 {
247     m_listeningThread.join();
248     for (auto& connectionThreads : m_connectionThreads)
249         connectionThreads.join();
250 }
251
252 auto TCPServer::socketBindListen(size_t connections) -> Optional<Socket>
253 {
254     Socket listeningSocket = socket(PF_INET, SOCK_STREAM, 0);
255     if (listeningSocket == -1)
256         return WTF::nullopt;
257     
258     // Ports 49152-65535 are unallocated ports. Try until we find one that's free.
259     for (Port port = 49152; port; port++) {
260         struct sockaddr_in name;
261         memset(&name, 0, sizeof(name));
262         name.sin_family = AF_INET;
263         name.sin_port = htons(port);
264         name.sin_addr.s_addr = htonl(INADDR_ANY);
265         if (bind(listeningSocket, reinterpret_cast<sockaddr*>(&name), sizeof(name)) < 0) {
266             // This port is busy. Try the next port.
267             continue;
268         }
269         if (listen(listeningSocket, connections) == -1) {
270             // Listening failed.
271             close(listeningSocket);
272             return WTF::nullopt;
273         }
274         m_port = port;
275         return listeningSocket; // Successfully set up listening port.
276     }
277     
278     // Couldn't find an available port.
279     close(listeningSocket);
280     return WTF::nullopt;
281 }
282
283 template<> Vector<uint8_t> TCPServer::read(Socket socket)
284 {
285     uint8_t buffer[1000];
286     auto bytesRead = ::read(socket, buffer, sizeof(buffer));
287     if (bytesRead <= 0)
288         return { };
289     ASSERT(static_cast<size_t>(bytesRead) < sizeof(buffer));
290
291     Vector<uint8_t> vector;
292     vector.append(buffer, bytesRead);
293     return vector;
294 }
295
296 template<> void TCPServer::write(Socket socket, const void* response, size_t length)
297 {
298     auto bytesWritten = ::write(socket, response, length);
299     EXPECT_EQ(static_cast<size_t>(bytesWritten), length);
300 }
301
302 #if HAVE(SSL)
303 template<> Vector<uint8_t> TCPServer::read(SSL* ssl)
304 {
305     uint8_t buffer[1000];
306     auto bytesRead = SSL_read(ssl, buffer, sizeof(buffer));
307     if (bytesRead <= 0)
308         return { };
309     ASSERT(static_cast<size_t>(bytesRead) < sizeof(buffer));
310
311     Vector<uint8_t> vector;
312     vector.append(buffer, bytesRead);
313     return vector;
314 }
315
316 template<> void TCPServer::write(SSL* ssl, const void* response, size_t length)
317 {
318     auto bytesWritten = SSL_write(ssl, response, length);
319     EXPECT_EQ(static_cast<size_t>(bytesWritten), length);
320 }
321 #endif
322
323 void TCPServer::respondWithChallengeThenOK(Socket socket)
324 {
325     read(socket);
326     
327     const char* challengeHeader =
328     "HTTP/1.1 401 Unauthorized\r\n"
329     "Date: Sat, 23 Mar 2019 06:29:01 GMT\r\n"
330     "Content-Length: 0\r\n"
331     "WWW-Authenticate: Basic realm=\"testrealm\"\r\n\r\n";
332     write(socket, challengeHeader, strlen(challengeHeader));
333     
334     read(socket);
335     
336     const char* responseHeader =
337     "HTTP/1.1 200 OK\r\n"
338     "Content-Length: 13\r\n\r\n"
339     "Hello, World!";
340     write(socket, responseHeader, strlen(responseHeader));
341 }
342
343 #if HAVE(SSL)
344 void TCPServer::respondWithOK(SSL* ssl)
345 {
346     read(ssl);
347     
348     const char* reply = ""
349     "HTTP/1.1 200 OK\r\n"
350     "Content-Length: 34\r\n\r\n"
351     "<script>alert('success!')</script>";
352     write(ssl, reply, strlen(reply));
353 }
354 #endif
355
356 Vector<uint8_t> TCPServer::testCertificate()
357 {
358     // Certificate and private key were generated by running this command:
359     // openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
360     // and entering this information:
361     /*
362      Country Name (2 letter code) []:US
363      State or Province Name (full name) []:New Mexico
364      Locality Name (eg, city) []:Santa Fe
365      Organization Name (eg, company) []:Self
366      Organizational Unit Name (eg, section) []:Myself
367      Common Name (eg, fully qualified host name) []:Me
368      Email Address []:me@example.com
369      */
370     
371     String pemEncodedCertificate(""
372     "MIIFgDCCA2gCCQCKHiPRU5MQuDANBgkqhkiG9w0BAQsFADCBgTELMAkGA1UEBhMC"
373     "VVMxEzARBgNVBAgMCk5ldyBNZXhpY28xETAPBgNVBAcMCFNhbnRhIEZlMQ0wCwYD"
374     "VQQKDARTZWxmMQ8wDQYDVQQLDAZNeXNlbGYxCzAJBgNVBAMMAk1lMR0wGwYJKoZI"
375     "hvcNAQkBFg5tZUBleGFtcGxlLmNvbTAeFw0xOTAzMjMwNTUwMTRaFw0yMDAzMjIw"
376     "NTUwMTRaMIGBMQswCQYDVQQGEwJVUzETMBEGA1UECAwKTmV3IE1leGljbzERMA8G"
377     "A1UEBwwIU2FudGEgRmUxDTALBgNVBAoMBFNlbGYxDzANBgNVBAsMBk15c2VsZjEL"
378     "MAkGA1UEAwwCTWUxHTAbBgkqhkiG9w0BCQEWDm1lQGV4YW1wbGUuY29tMIICIjAN"
379     "BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA3rhN4SPg8VY/PtGDNKY3T9JISgby"
380     "8YGMJx0vO+YZFZm3G3fsTUsyvDyEHwqp5abCZRB/By1PwWkNrfxn/XP8P034JPlE"
381     "6irViuAYQrqUh6k7ZR8CpOM5GEcRZgAUJGGQwNlOkEwaHnMGc8SsHurgDPh5XBpg"
382     "bDytd7BJuB1NoI/KJmhcajkAuV3varS+uPLofPHNqe+cL8hNnjZQwHWarP45ks4e"
383     "BcOD7twqxuHnVm/FWErpY8Ws5s1MrPThUdDahjEMf+YfDJ9KL8y304yS8J8feCxY"
384     "fcH4BvgLtJmBNHJgj3eND/EMZjJgz2FsBjrJk8kKD31cw+4Wp8UF4skWXCf46+mN"
385     "OHp13PeSCZLyF4ZAHazUVknDPcc2YNrWVV1i6n3T15kI0T5Z7bstdmALuSkE2cuJ"
386     "SVNO6gR+ZsVRTneuQxwWTU0MNEhAPFOX2BhGP5eisgEUzknxMJddFDn9Wxklu1Jh"
387     "gkzASA/+3AmlrFZMPhOhjEul0zjgNR5RBl1G8Hz92LAx5UEDBtdLg71I+I8AzQOh"
388     "d6LtBekECxA16pSappg5vcW9Z/8N6ZlsHnZ2FztA0nCOflkoO9iejOpcuFN4EVYD"
389     "xItwctKw1LCeND/s4kmoRRnXbX7k9O6cI1UUWM595Gsu5tPa33M5AZFCav2gOVuY"
390     "djppS0HOfo5hv6cCAwEAATANBgkqhkiG9w0BAQsFAAOCAgEAY8EWaAFEfw7OV+oD"
391     "XUZSIYXq3EH2E5p3q38AhIOLRjBuB+utyu7Q6rxMMHuw2TtsN+zbAR7yrjfsseA3"
392     "4TM1xe4Nk7NVNHRoZQ+C0Iqf9fvcioMvT1tTrma0MhKSjFQpx+PvyLVbD7YdP86L"
393     "meehKqU7h1pLGAiGwjoaZ9Ybh6Kuq/MTAHy3D8+wk7B36VBxF6diVlUPZJZQWKJy"
394     "MKy9G3sze1ZGt9WeE0AMvkN2HIef0HTKCUZ3eBvecOMijxL0WhWo5Qyf5k6ylCaU"
395     "2fx+M8DfDcwFo7tSgLxSK3GCFpxPfiDt6Qk8c9tQn5S1gY3t6LJuwVCFwUIXlNkB"
396     "JD7+cZ1Z/tCrEhzj3YCk0uUU8CifoU+4FG+HGFP+SPztsYE055mSj3+Esh+oyoVB"
397     "gBH90sE2T1i0eNI8f61oSgwYFeHsf7fC71XEXLFR+GwNdmwqlmwlDZEpTu7BoNN+"
398     "q7+Tfk1MRkJlL1PH6Yu/IPhZiNh4tyIqDOtlYfzp577A+OUU+q5PPRFRIsqheOxt"
399     "mNlHx4Uzd4U3ITfmogJazjqwYO2viBZY4jUQmyZs75eH/jiUFHWRsha3AdnW5LWa"
400     "G3PFnYbW8urH0NSJG/W+/9DA+Y7Aa0cs4TPpuBGZ0NU1W94OoCMo4lkO6H/y6Leu"
401     "3vjZD3y9kZk7mre9XHwkI8MdK5s=");
402     
403     Vector<uint8_t> vector;
404     base64Decode(pemEncodedCertificate, vector, WTF::Base64DecodeOptions::Base64Default);
405     return vector;
406 }
407
408 Vector<uint8_t> TCPServer::testPrivateKey()
409 {
410     String pemEncodedPrivateKey(""
411     "MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDeuE3hI+DxVj8+"
412     "0YM0pjdP0khKBvLxgYwnHS875hkVmbcbd+xNSzK8PIQfCqnlpsJlEH8HLU/BaQ2t"
413     "/Gf9c/w/Tfgk+UTqKtWK4BhCupSHqTtlHwKk4zkYRxFmABQkYZDA2U6QTBoecwZz"
414     "xKwe6uAM+HlcGmBsPK13sEm4HU2gj8omaFxqOQC5Xe9qtL648uh88c2p75wvyE2e"
415     "NlDAdZqs/jmSzh4Fw4Pu3CrG4edWb8VYSuljxazmzUys9OFR0NqGMQx/5h8Mn0ov"
416     "zLfTjJLwnx94LFh9wfgG+Au0mYE0cmCPd40P8QxmMmDPYWwGOsmTyQoPfVzD7han"
417     "xQXiyRZcJ/jr6Y04enXc95IJkvIXhkAdrNRWScM9xzZg2tZVXWLqfdPXmQjRPlnt"
418     "uy12YAu5KQTZy4lJU07qBH5mxVFOd65DHBZNTQw0SEA8U5fYGEY/l6KyARTOSfEw"
419     "l10UOf1bGSW7UmGCTMBID/7cCaWsVkw+E6GMS6XTOOA1HlEGXUbwfP3YsDHlQQMG"
420     "10uDvUj4jwDNA6F3ou0F6QQLEDXqlJqmmDm9xb1n/w3pmWwednYXO0DScI5+WSg7"
421     "2J6M6ly4U3gRVgPEi3By0rDUsJ40P+ziSahFGddtfuT07pwjVRRYzn3kay7m09rf"
422     "czkBkUJq/aA5W5h2OmlLQc5+jmG/pwIDAQABAoICAGra/Cp/f0Xqvk9ST+Prt2/p"
423     "kNtLeDXclLSTcP0JCZHufQaFw+7VnFLpqe4GvLq9Bllcz8VOvQwrbe/CwNW+VxC8"
424     "RMjge2rqACgwGhOx1t87l46NkUQw7Ey0lCle8kr+MGgGGoZqrMFdKIRUoMv4nmQ6"
425     "tmc1FHv5pLRe9Q+Lp5nYQwGoYmZoUOueoOaOL08m49pGXQkiN8pJDMxSfO3Jvtsu"
426     "4cqIb6kOQ/dO1Is1CTvURld1IYLH7YuShi4ZEx2g2ac2Uyvt6YmxxvMmAjBSKpGd"
427     "loiepho3/NrDGUKdv3q9QYyzrA8w9GT32LDGqgBXJi1scBI8cExkp6P4iDllhv7s"
428     "vZsspvobRJa3O1zk863LHXa24JCnyuzimqezZ2Olh7l4olHoYD6UFC9jfd4KcHRg"
429     "1c4syqt/n8AK/1s1eBfS9dzb5Cfjt9MtKYslxvLzq1WwOINwz8rIYuRi0PcLm9hs"
430     "l+U0u/zB37eMgv6+iwDXk1fSjbuYsE/bETWYknKGNFFL5JSiKV7WCpmgNTTrrE4K"
431     "S8E6hR9uPOAaow7vPCCt4xLX/48l2EI6Zeq6qOpq1lJ2qcy8r4tyuQgNRLQMkZg1"
432     "AxQl6vnQ8Cu4iu+NIhef0y9Z7qkfNvZeCj5GlFB9c2YjV8Y2mdWfJB4qWK3Z/+MJ"
433     "QOTCKRz7/LxLNBUepRjJAoIBAQD3ZsV5tWU9ZSKcVJ9DC7TZk0P+lhcisZr0nL0t"
434     "PQuQO+pHvPI1MqRnNskHJhyPnqVCi+dp89tK/It590ULl8os6UC1FhytBPoT1YPd"
435     "WGWep2pOc7bVpi4ip31y+ImfgeZyJtMATdme3kBPAOe5NGE9Gig/l5nqLyb02sd1"
436     "QW7O0GdqLx3DpLw4SLlhMf6aE0uGRS8sfB085e4DGn54O2wEVuSZqZl5NNEf35Rz"
437     "Xgim3h+RWF1ZFSQzjB/smN0Zh+v3Iz7vEJ1h0ywV6o+GzvHkP9HE6gLIhtyV8OEw"
438     "vlyYk1Ga7pUVGRh8o8OMe6RR9DQi7JqC4eI7GckmBzaqzJcDAoIBAQDmde6ATew3"
439     "H9bQK6xnbMIncz/COpIISdlcFb23AHGEb4b4VhJFBNwxrNL6tHKSFLeYZFLhTdhx"
440     "PfXyULHNf5ozdEkl0WrleroDdogbCyWg5uJp9/Q68sbwbGr8CAlO7ZHYTrjuQf1K"
441     "AS9pCm77KP3k2d3UlG+pelDjXLoBziXq0NjxJpMz45vrIx8rSWzFNjMGjXT3fXaS"
442     "962k/0AXei5/bfuhBxlm7Pni0bQJIWFkeaUuGlrOaHDRxUiX1r9IZS9wv5lk1Ptg"
443     "idpbcWyw18cFGTvjdKhRbZH8EsbmzmNNsCGdgCMqFkKYsW16QKoCj/NAovI3n0qn"
444     "6VoRa0sGmTGNAoIBACl/mqZEsBuxSDHy29gSMZ7BXglpQa43HmfjlrPs5nCmLDEm"
445     "V3Zm7T7G6MeDNA0/LjdQYlvaZLFaVUb7HCDKsEYCRjFZ6St4hz4mdXz+Y+VN7b4F"
446     "GOkTe++iKp/LYsJXtsD1FDWb2WIVo7Hc1AGz8I+gQJoSIuYuTJmLzSM0+5JDUOV1"
447     "y8dSbaP/RuEv0qYjkGqQVk5e70SUyOzKV+ZxCThdHvFLiovTOTTgevUzE75xydfG"
448     "e7oCmtTurzgvl/69Vu5Ygij1n4CWPHHcq4CQW/DOZ7BhFGBwhrW79voHJF8PbwPO"
449     "+0DTudDGY3nAD5sTnF8zUuObYihJtfzj/t59fOMCggEBAIYuuBUASb62zQ4bv5/g"
450     "VRM/KSpfi9NDnEjfZ7x7h5zCiuVgx/ZjpAlQRO8vzV18roEOOKtx9cnJd8AEd+Hc"
451     "n93BoS1hx0mhsVh+1TRZwyjyBXYJpqwD2wz1Mz1XOIQ6EqbM/yPKTD2gfwg7yO53"
452     "qYxrxZsWagVVcG9Q+ARBERatTwLpoN+fcJLxuh4r/Ca/LepsxmOrKzTa/MGK1LhW"
453     "rWgIk2/ogEPLSptj2d1PEDO+GAzFz4VKjhW1NlUh9fGi6IJPLHLnBw3odbi0S8KT"
454     "gA9Z5+LBc5clotAP5rtQA8Wh/ZCEoPTKTTA2bjW2HMatJcbGmR0FpCQr3AM0Y1SO"
455     "MakCggEALru6QZ6YUwJJG45H1eq/rPdDY8tqqjJVViKoBVvzKj/XfJZYEVQiIw5p"
456     "uoGhDoyFuFUeIh/d1Jc2Iruy2WjoOkiQYtIugDHHxRrkLdQcjPhlCTCE/mmySJt+"
457     "bkUbiHIbQ8dJ5yj8SKr0bHzqEtOy9/JeRjkYGHC6bVWpq5FA2MBhf4dNjJ4UDlnT"
458     "vuePcTjr7nnfY1sztvfVl9D8dmgT+TBnOOV6yWj1gm5bS1DxQSLgNmtKxJ8tAh2u"
459     "dEObvcpShP22ItOVjSampRuAuRG26ZemEbGCI3J6Mqx3y6m+6HwultsgtdzDgrFe"
460     "qJfU8bbdbu2pi47Y4FdJK0HLffl5Rw==");
461
462     Vector<uint8_t> vector;
463     base64Decode(pemEncodedPrivateKey, vector, WTF::Base64DecodeOptions::Base64Default);
464     return vector;
465 }
466     
467 } // namespace TestWebKitAPI