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