Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: net/test/base_test_server.h

Issue 9663017: net: add OCSP tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/ocsp/nss_ocsp.cc ('k') | net/test/base_test_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_TEST_BASE_TEST_SERVER_H_ 5 #ifndef NET_TEST_BASE_TEST_SERVER_H_
6 #define NET_TEST_BASE_TEST_SERVER_H_ 6 #define NET_TEST_BASE_TEST_SERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 28 matching lines...) Expand all
39 TYPE_SYNC, 39 TYPE_SYNC,
40 TYPE_TCP_ECHO, 40 TYPE_TCP_ECHO,
41 TYPE_UDP_ECHO, 41 TYPE_UDP_ECHO,
42 }; 42 };
43 43
44 // Container for various options to control how the HTTPS server is 44 // Container for various options to control how the HTTPS server is
45 // initialized. 45 // initialized.
46 struct HTTPSOptions { 46 struct HTTPSOptions {
47 enum ServerCertificate { 47 enum ServerCertificate {
48 CERT_OK, 48 CERT_OK,
49
50 // CERT_AUTO causes the testserver to generate a test certificate issued
51 // by "Testing CA" (see net/data/ssl/certificates/ocsp-test-root.pem).
52 CERT_AUTO,
53
49 CERT_MISMATCHED_NAME, 54 CERT_MISMATCHED_NAME,
50 CERT_EXPIRED, 55 CERT_EXPIRED,
51 // Cross-signed certificate to test PKIX path building. Contains an 56 // Cross-signed certificate to test PKIX path building. Contains an
52 // intermediate cross-signed by an unknown root, while the client (via 57 // intermediate cross-signed by an unknown root, while the client (via
53 // TestRootStore) is expected to have a self-signed version of the 58 // TestRootStore) is expected to have a self-signed version of the
54 // intermediate. 59 // intermediate.
55 CERT_CHAIN_WRONG_ROOT, 60 CERT_CHAIN_WRONG_ROOT,
56 }; 61 };
57 62
63 // OCSPStatus enumerates the types of OCSP response that the testserver
64 // can produce.
65 enum OCSPStatus {
66 OCSP_OK,
67 OCSP_REVOKED,
68 OCSP_INVALID,
69 };
70
58 // Bitmask of bulk encryption algorithms that the test server supports 71 // Bitmask of bulk encryption algorithms that the test server supports
59 // and that can be selectively enabled or disabled. 72 // and that can be selectively enabled or disabled.
60 enum BulkCipher { 73 enum BulkCipher {
61 // Special value used to indicate that any algorithm the server supports 74 // Special value used to indicate that any algorithm the server supports
62 // is acceptable. Preferred over explicitly OR-ing all ciphers. 75 // is acceptable. Preferred over explicitly OR-ing all ciphers.
63 BULK_CIPHER_ANY = 0, 76 BULK_CIPHER_ANY = 0,
64 77
65 BULK_CIPHER_RC4 = (1 << 0), 78 BULK_CIPHER_RC4 = (1 << 0),
66 BULK_CIPHER_AES128 = (1 << 1), 79 BULK_CIPHER_AES128 = (1 << 1),
67 BULK_CIPHER_AES256 = (1 << 2), 80 BULK_CIPHER_AES256 = (1 << 2),
68 81
69 // NOTE: 3DES support in the Python test server has external 82 // NOTE: 3DES support in the Python test server has external
70 // dependencies and not be available on all machines. Clients may not 83 // dependencies and not be available on all machines. Clients may not
71 // be able to connect if only 3DES is specified. 84 // be able to connect if only 3DES is specified.
72 BULK_CIPHER_3DES = (1 << 3), 85 BULK_CIPHER_3DES = (1 << 3),
73 }; 86 };
74 87
75 // Initialize a new HTTPSOptions using CERT_OK as the certificate. 88 // Initialize a new HTTPSOptions using CERT_OK as the certificate.
76 HTTPSOptions(); 89 HTTPSOptions();
77 90
78 // Initialize a new HTTPSOptions that will use the specified certificate. 91 // Initialize a new HTTPSOptions that will use the specified certificate.
79 explicit HTTPSOptions(ServerCertificate cert); 92 explicit HTTPSOptions(ServerCertificate cert);
80 ~HTTPSOptions(); 93 ~HTTPSOptions();
81 94
82 // Returns the relative filename of the file that contains the 95 // Returns the relative filename of the file that contains the
83 // |server_certificate|. 96 // |server_certificate|.
84 FilePath GetCertificateFile() const; 97 FilePath GetCertificateFile() const;
85 98
99 // GetOCSPArgument returns the value of any OCSP argument to testserver or
100 // the empty string if there is none.
101 std::string GetOCSPArgument() const;
102
86 // The certificate to use when serving requests. 103 // The certificate to use when serving requests.
87 ServerCertificate server_certificate; 104 ServerCertificate server_certificate;
88 105
106 // If |server_certificate==CERT_AUTO| then this determines the type of OCSP
107 // response returned.
108 OCSPStatus ocsp_status;
109
89 // True if a CertificateRequest should be sent to the client during 110 // True if a CertificateRequest should be sent to the client during
90 // handshaking. 111 // handshaking.
91 bool request_client_certificate; 112 bool request_client_certificate;
92 113
93 // If |request_client_certificate| is true, an optional list of files, 114 // If |request_client_certificate| is true, an optional list of files,
94 // each containing a single, PEM-encoded X.509 certificates. The subject 115 // each containing a single, PEM-encoded X.509 certificates. The subject
95 // from each certificate will be added to the certificate_authorities 116 // from each certificate will be added to the certificate_authorities
96 // field of the CertificateRequest. 117 // field of the CertificateRequest.
97 std::vector<FilePath> client_authorities; 118 std::vector<FilePath> client_authorities;
98 119
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 225
205 scoped_ptr<ScopedPortException> allowed_port_; 226 scoped_ptr<ScopedPortException> allowed_port_;
206 227
207 DISALLOW_COPY_AND_ASSIGN(BaseTestServer); 228 DISALLOW_COPY_AND_ASSIGN(BaseTestServer);
208 }; 229 };
209 230
210 } // namespace net 231 } // namespace net
211 232
212 #endif // NET_TEST_BASE_TEST_SERVER_H_ 233 #endif // NET_TEST_BASE_TEST_SERVER_H_
213 234
OLDNEW
« no previous file with comments | « net/ocsp/nss_ocsp.cc ('k') | net/test/base_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698