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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // and issuer name, otherwise a random string will be used. The key type and | 194 // and issuer name, otherwise a random string will be used. The key type and |
195 // parameters are defined in |key_param|. The certificate's lifetime in | 195 // parameters are defined in |key_param|. The certificate's lifetime in |
196 // seconds from the current time is defined in |certificate_lifetime|; it | 196 // seconds from the current time is defined in |certificate_lifetime|; it |
197 // should be a non-negative number. | 197 // should be a non-negative number. |
198 // Returns NULL on failure. | 198 // Returns NULL on failure. |
199 // Caller is responsible for freeing the returned object. | 199 // Caller is responsible for freeing the returned object. |
200 static SSLIdentity* Generate(const std::string& common_name, | 200 static SSLIdentity* Generate(const std::string& common_name, |
201 const KeyParams& key_param, | 201 const KeyParams& key_param, |
202 time_t certificate_lifetime); | 202 time_t certificate_lifetime); |
203 static SSLIdentity* Generate(const std::string& common_name, | 203 static SSLIdentity* Generate(const std::string& common_name, |
204 const KeyParams& key_param) { | 204 const KeyParams& key_param); |
205 return Generate(common_name, key_param, kDefaultCertificateLifetime); | |
206 } | |
207 static SSLIdentity* Generate(const std::string& common_name, | 205 static SSLIdentity* Generate(const std::string& common_name, |
208 KeyType key_type) { | 206 KeyType key_type); |
209 return Generate(common_name, KeyParams(key_type)); | |
210 } | |
211 | 207 |
212 // Generates an identity with the specified validity period. | 208 // Generates an identity with the specified validity period. |
213 // TODO(torbjorng): Now that Generate() accepts relevant params, make tests | 209 // TODO(torbjorng): Now that Generate() accepts relevant params, make tests |
214 // use that instead of this function. | 210 // use that instead of this function. |
215 static SSLIdentity* GenerateForTest(const SSLIdentityParams& params); | 211 static SSLIdentity* GenerateForTest(const SSLIdentityParams& params); |
216 | 212 |
217 // Construct an identity from a private key and a certificate. | 213 // Construct an identity from a private key and a certificate. |
218 static SSLIdentity* FromPEMStrings(const std::string& private_key, | 214 static SSLIdentity* FromPEMStrings(const std::string& private_key, |
219 const std::string& certificate); | 215 const std::string& certificate); |
220 | 216 |
(...skipping 22 matching lines...) Expand all Loading... |
243 // |s| is not 0-terminated; its char count is defined by |length|. | 239 // |s| is not 0-terminated; its char count is defined by |length|. |
244 int64_t ASN1TimeToSec(const unsigned char* s, size_t length, bool long_format); | 240 int64_t ASN1TimeToSec(const unsigned char* s, size_t length, bool long_format); |
245 | 241 |
246 extern const char kPemTypeCertificate[]; | 242 extern const char kPemTypeCertificate[]; |
247 extern const char kPemTypeRsaPrivateKey[]; | 243 extern const char kPemTypeRsaPrivateKey[]; |
248 extern const char kPemTypeEcPrivateKey[]; | 244 extern const char kPemTypeEcPrivateKey[]; |
249 | 245 |
250 } // namespace rtc | 246 } // namespace rtc |
251 | 247 |
252 #endif // WEBRTC_BASE_SSLIDENTITY_H_ | 248 #endif // WEBRTC_BASE_SSLIDENTITY_H_ |
OLD | NEW |