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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 X509* x509_; | 95 X509* x509_; |
96 | 96 |
97 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLCertificate); | 97 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLCertificate); |
98 }; | 98 }; |
99 | 99 |
100 // Holds a keypair and certificate together, and a method to generate | 100 // Holds a keypair and certificate together, and a method to generate |
101 // them consistently. | 101 // them consistently. |
102 class OpenSSLIdentity : public SSLIdentity { | 102 class OpenSSLIdentity : public SSLIdentity { |
103 public: | 103 public: |
104 static OpenSSLIdentity* Generate(const std::string& common_name, | 104 static OpenSSLIdentity* GenerateWithExpiration(const std::string& common_name, |
105 const KeyParams& key_params, | 105 const KeyParams& key_params, |
106 time_t certificate_lifetime); | 106 time_t certificate_lifetime); |
107 static OpenSSLIdentity* GenerateForTest(const SSLIdentityParams& params); | 107 static OpenSSLIdentity* GenerateForTest(const SSLIdentityParams& params); |
108 static SSLIdentity* FromPEMStrings(const std::string& private_key, | 108 static SSLIdentity* FromPEMStrings(const std::string& private_key, |
109 const std::string& certificate); | 109 const std::string& certificate); |
110 ~OpenSSLIdentity() override; | 110 ~OpenSSLIdentity() override; |
111 | 111 |
112 const OpenSSLCertificate& certificate() const override; | 112 const OpenSSLCertificate& certificate() const override; |
113 OpenSSLIdentity* GetReference() const override; | 113 OpenSSLIdentity* GetReference() const override; |
114 | 114 |
115 // Configure an SSL context object to use our key and certificate. | 115 // Configure an SSL context object to use our key and certificate. |
116 bool ConfigureIdentity(SSL_CTX* ctx); | 116 bool ConfigureIdentity(SSL_CTX* ctx); |
117 | 117 |
118 private: | 118 private: |
119 OpenSSLIdentity(OpenSSLKeyPair* key_pair, OpenSSLCertificate* certificate); | 119 OpenSSLIdentity(OpenSSLKeyPair* key_pair, OpenSSLCertificate* certificate); |
120 | 120 |
121 static OpenSSLIdentity* GenerateInternal(const SSLIdentityParams& params); | 121 static OpenSSLIdentity* GenerateInternal(const SSLIdentityParams& params); |
122 | 122 |
123 scoped_ptr<OpenSSLKeyPair> key_pair_; | 123 scoped_ptr<OpenSSLKeyPair> key_pair_; |
124 scoped_ptr<OpenSSLCertificate> certificate_; | 124 scoped_ptr<OpenSSLCertificate> certificate_; |
125 | 125 |
126 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity); | 126 RTC_DISALLOW_COPY_AND_ASSIGN(OpenSSLIdentity); |
127 }; | 127 }; |
128 | 128 |
129 | 129 |
130 } // namespace rtc | 130 } // namespace rtc |
131 | 131 |
132 #endif // WEBRTC_BASE_OPENSSLIDENTITY_H_ | 132 #endif // WEBRTC_BASE_OPENSSLIDENTITY_H_ |
OLD | NEW |