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 21 matching lines...) Expand all Loading... |
32 ASSERT(pkey_ != NULL); | 32 ASSERT(pkey_ != NULL); |
33 } | 33 } |
34 | 34 |
35 static OpenSSLKeyPair* Generate(const KeyParams& key_params); | 35 static OpenSSLKeyPair* Generate(const KeyParams& key_params); |
36 | 36 |
37 virtual ~OpenSSLKeyPair(); | 37 virtual ~OpenSSLKeyPair(); |
38 | 38 |
39 virtual OpenSSLKeyPair* GetReference(); | 39 virtual OpenSSLKeyPair* GetReference(); |
40 | 40 |
41 EVP_PKEY* pkey() const { return pkey_; } | 41 EVP_PKEY* pkey() const { return pkey_; } |
| 42 std::string PrivateKeyToPemString() const; |
42 | 43 |
43 private: | 44 private: |
44 void AddReference(); | 45 void AddReference(); |
45 | 46 |
46 EVP_PKEY* pkey_; | 47 EVP_PKEY* pkey_; |
47 | 48 |
48 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyPair); | 49 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLKeyPair); |
49 }; | 50 }; |
50 | 51 |
51 // OpenSSLCertificate encapsulates an OpenSSL X509* certificate object, | 52 // OpenSSLCertificate encapsulates an OpenSSL X509* certificate object, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 static SSLIdentity* FromPEMStrings(const std::string& private_key, | 109 static SSLIdentity* FromPEMStrings(const std::string& private_key, |
109 const std::string& certificate); | 110 const std::string& certificate); |
110 ~OpenSSLIdentity() override; | 111 ~OpenSSLIdentity() override; |
111 | 112 |
112 const OpenSSLCertificate& certificate() const override; | 113 const OpenSSLCertificate& certificate() const override; |
113 OpenSSLIdentity* GetReference() const override; | 114 OpenSSLIdentity* GetReference() const override; |
114 | 115 |
115 // Configure an SSL context object to use our key and certificate. | 116 // Configure an SSL context object to use our key and certificate. |
116 bool ConfigureIdentity(SSL_CTX* ctx); | 117 bool ConfigureIdentity(SSL_CTX* ctx); |
117 | 118 |
| 119 std::string PrivateKeyToPemString() const override; |
| 120 |
118 private: | 121 private: |
119 OpenSSLIdentity(OpenSSLKeyPair* key_pair, OpenSSLCertificate* certificate); | 122 OpenSSLIdentity(OpenSSLKeyPair* key_pair, OpenSSLCertificate* certificate); |
120 | 123 |
121 static OpenSSLIdentity* GenerateInternal(const SSLIdentityParams& params); | 124 static OpenSSLIdentity* GenerateInternal(const SSLIdentityParams& params); |
122 | 125 |
123 scoped_ptr<OpenSSLKeyPair> key_pair_; | 126 scoped_ptr<OpenSSLKeyPair> key_pair_; |
124 scoped_ptr<OpenSSLCertificate> certificate_; | 127 scoped_ptr<OpenSSLCertificate> certificate_; |
125 | 128 |
126 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity); | 129 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity); |
127 }; | 130 }; |
128 | 131 |
129 | 132 |
130 } // namespace rtc | 133 } // namespace rtc |
131 | 134 |
132 #endif // WEBRTC_BASE_OPENSSLIDENTITY_H_ | 135 #endif // WEBRTC_BASE_OPENSSLIDENTITY_H_ |
OLD | NEW |