OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 // Handling of certificates and keypairs for SSLStreamAdapter's peer mode. | 11 // Handling of certificates and keypairs for SSLStreamAdapter's peer mode. |
12 | 12 |
13 #ifndef WEBRTC_BASE_SSLIDENTITY_H_ | 13 #ifndef WEBRTC_BASE_SSLIDENTITY_H_ |
14 #define WEBRTC_BASE_SSLIDENTITY_H_ | 14 #define WEBRTC_BASE_SSLIDENTITY_H_ |
15 | 15 |
16 #include <algorithm> | 16 #include <algorithm> |
17 #include <string> | 17 #include <string> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "webrtc/base/buffer.h" | 20 #include "webrtc/base/buffer.h" |
21 #include "webrtc/base/messagedigest.h" | 21 #include "webrtc/base/messagedigest.h" |
22 | 22 |
23 namespace rtc { | 23 namespace rtc { |
24 | 24 |
25 enum KeyType { KT_RSA, KT_ECDSA, KT_LAST, KT_DEFAULT = KT_RSA }; | |
26 | |
27 // Forward declaration due to circular dependency with SSLCertificate. | 25 // Forward declaration due to circular dependency with SSLCertificate. |
28 class SSLCertChain; | 26 class SSLCertChain; |
29 | 27 |
30 // Abstract interface overridden by SSL library specific | 28 // Abstract interface overridden by SSL library specific |
31 // implementations. | 29 // implementations. |
32 | 30 |
33 // A somewhat opaque type used to encapsulate a certificate. | 31 // A somewhat opaque type used to encapsulate a certificate. |
34 // Wraps the SSL library's notion of a certificate, with reference counting. | 32 // Wraps the SSL library's notion of a certificate, with reference counting. |
35 // The SSLCertificate object is pretty much immutable once created. | 33 // The SSLCertificate object is pretty much immutable once created. |
36 // (The OpenSSL implementation only does reference counting and | 34 // (The OpenSSL implementation only does reference counting and |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 100 } |
103 | 101 |
104 // Helper function for deleting a vector of certificates. | 102 // Helper function for deleting a vector of certificates. |
105 static void DeleteCert(SSLCertificate* cert) { delete cert; } | 103 static void DeleteCert(SSLCertificate* cert) { delete cert; } |
106 | 104 |
107 std::vector<SSLCertificate*> certs_; | 105 std::vector<SSLCertificate*> certs_; |
108 | 106 |
109 DISALLOW_COPY_AND_ASSIGN(SSLCertChain); | 107 DISALLOW_COPY_AND_ASSIGN(SSLCertChain); |
110 }; | 108 }; |
111 | 109 |
| 110 enum KeyType { KT_RSA, KT_ECDSA, KT_LAST, KT_DEFAULT = KT_RSA }; |
| 111 |
112 // Parameters for generating an identity for testing. If common_name is | 112 // Parameters for generating an identity for testing. If common_name is |
113 // non-empty, it will be used for the certificate's subject and issuer name, | 113 // non-empty, it will be used for the certificate's subject and issuer name, |
114 // otherwise a random string will be used. |not_before| and |not_after| are | 114 // otherwise a random string will be used. |not_before| and |not_after| are |
115 // offsets to the current time in number of seconds. | 115 // offsets to the current time in number of seconds. |
116 struct SSLIdentityParams { | 116 struct SSLIdentityParams { |
117 std::string common_name; | 117 std::string common_name; |
118 int not_before; // in seconds. | 118 int not_before; // in seconds. |
119 int not_after; // in seconds. | 119 int not_after; // in seconds. |
120 }; | 120 }; |
121 | 121 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 const unsigned char* data, | 156 const unsigned char* data, |
157 size_t length); | 157 size_t length); |
158 }; | 158 }; |
159 | 159 |
160 extern const char kPemTypeCertificate[]; | 160 extern const char kPemTypeCertificate[]; |
161 extern const char kPemTypeRsaPrivateKey[]; | 161 extern const char kPemTypeRsaPrivateKey[]; |
162 | 162 |
163 } // namespace rtc | 163 } // namespace rtc |
164 | 164 |
165 #endif // WEBRTC_BASE_SSLIDENTITY_H_ | 165 #endif // WEBRTC_BASE_SSLIDENTITY_H_ |
OLD | NEW |