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 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 virtual ~SSLIdentity() {} | 219 virtual ~SSLIdentity() {} |
220 | 220 |
221 // Returns a new SSLIdentity object instance wrapping the same | 221 // Returns a new SSLIdentity object instance wrapping the same |
222 // identity information. | 222 // identity information. |
223 // Caller is responsible for freeing the returned object. | 223 // Caller is responsible for freeing the returned object. |
224 // TODO(hbos,torbjorng): Rename to a less confusing name. | 224 // TODO(hbos,torbjorng): Rename to a less confusing name. |
225 virtual SSLIdentity* GetReference() const = 0; | 225 virtual SSLIdentity* GetReference() const = 0; |
226 | 226 |
227 // Returns a temporary reference to the certificate. | 227 // Returns a temporary reference to the certificate. |
228 virtual const SSLCertificate& certificate() const = 0; | 228 virtual const SSLCertificate& certificate() const = 0; |
| 229 virtual std::string PrivateKeyToPEMString() const = 0; |
| 230 virtual std::string PublicKeyToPEMString() const = 0; |
229 | 231 |
230 // Helpers for parsing converting between PEM and DER format. | 232 // Helpers for parsing converting between PEM and DER format. |
231 static bool PemToDer(const std::string& pem_type, | 233 static bool PemToDer(const std::string& pem_type, |
232 const std::string& pem_string, | 234 const std::string& pem_string, |
233 std::string* der); | 235 std::string* der); |
234 static std::string DerToPem(const std::string& pem_type, | 236 static std::string DerToPem(const std::string& pem_type, |
235 const unsigned char* data, | 237 const unsigned char* data, |
236 size_t length); | 238 size_t length); |
237 }; | 239 }; |
238 | 240 |
| 241 bool operator==(const SSLIdentity& a, const SSLIdentity& b); |
| 242 bool operator!=(const SSLIdentity& a, const SSLIdentity& b); |
| 243 |
239 // Convert from ASN1 time as restricted by RFC 5280 to seconds from 1970-01-01 | 244 // Convert from ASN1 time as restricted by RFC 5280 to seconds from 1970-01-01 |
240 // 00.00 ("epoch"). If the ASN1 time cannot be read, return -1. The data at | 245 // 00.00 ("epoch"). If the ASN1 time cannot be read, return -1. The data at |
241 // |s| is not 0-terminated; its char count is defined by |length|. | 246 // |s| is not 0-terminated; its char count is defined by |length|. |
242 int64_t ASN1TimeToSec(const unsigned char* s, size_t length, bool long_format); | 247 int64_t ASN1TimeToSec(const unsigned char* s, size_t length, bool long_format); |
243 | 248 |
244 extern const char kPemTypeCertificate[]; | 249 extern const char kPemTypeCertificate[]; |
245 extern const char kPemTypeRsaPrivateKey[]; | 250 extern const char kPemTypeRsaPrivateKey[]; |
246 extern const char kPemTypeEcPrivateKey[]; | 251 extern const char kPemTypeEcPrivateKey[]; |
247 | 252 |
248 } // namespace rtc | 253 } // namespace rtc |
249 | 254 |
250 #endif // WEBRTC_BASE_SSLIDENTITY_H_ | 255 #endif // WEBRTC_BASE_SSLIDENTITY_H_ |
OLD | NEW |