Move SSLIdentity Generate() implementations from .h to .cc file.

This amends https://codereview.webrtc.org/1683193003/

BUG=
R=hbos@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1701953002 .

Cr-Commit-Position: refs/heads/master@{#11632}
This commit is contained in:
Torbjorn Granlund
2016-02-16 13:33:53 +01:00
parent 71e92dc5e8
commit a3dc79e072
2 changed files with 19 additions and 6 deletions

View File

@ -154,10 +154,12 @@ SSLCertChain::~SSLCertChain() {
#if SSL_USE_OPENSSL #if SSL_USE_OPENSSL
// static
SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) { SSLCertificate* SSLCertificate::FromPEMString(const std::string& pem_string) {
return OpenSSLCertificate::FromPEMString(pem_string); return OpenSSLCertificate::FromPEMString(pem_string);
} }
// static
SSLIdentity* SSLIdentity::Generate(const std::string& common_name, SSLIdentity* SSLIdentity::Generate(const std::string& common_name,
const KeyParams& key_params, const KeyParams& key_params,
time_t certificate_lifetime) { time_t certificate_lifetime) {
@ -165,10 +167,25 @@ SSLIdentity* SSLIdentity::Generate(const std::string& common_name,
certificate_lifetime); certificate_lifetime);
} }
// static
SSLIdentity* SSLIdentity::Generate(const std::string& common_name,
const KeyParams& key_params) {
return OpenSSLIdentity::Generate(common_name, key_params,
kDefaultCertificateLifetime);
}
// static
SSLIdentity* SSLIdentity::Generate(const std::string& common_name,
KeyType key_type) {
return OpenSSLIdentity::Generate(common_name, KeyParams(key_type),
kDefaultCertificateLifetime);
}
SSLIdentity* SSLIdentity::GenerateForTest(const SSLIdentityParams& params) { SSLIdentity* SSLIdentity::GenerateForTest(const SSLIdentityParams& params) {
return OpenSSLIdentity::GenerateForTest(params); return OpenSSLIdentity::GenerateForTest(params);
} }
// static
SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key, SSLIdentity* SSLIdentity::FromPEMStrings(const std::string& private_key,
const std::string& certificate) { const std::string& certificate) {
return OpenSSLIdentity::FromPEMStrings(private_key, certificate); return OpenSSLIdentity::FromPEMStrings(private_key, certificate);

View File

@ -201,13 +201,9 @@ class SSLIdentity {
const KeyParams& key_param, const KeyParams& key_param,
time_t certificate_lifetime); time_t certificate_lifetime);
static SSLIdentity* Generate(const std::string& common_name, static SSLIdentity* Generate(const std::string& common_name,
const KeyParams& key_param) { const KeyParams& key_param);
return Generate(common_name, key_param, kDefaultCertificateLifetime);
}
static SSLIdentity* Generate(const std::string& common_name, static SSLIdentity* Generate(const std::string& common_name,
KeyType key_type) { KeyType key_type);
return Generate(common_name, KeyParams(key_type));
}
// Generates an identity with the specified validity period. // Generates an identity with the specified validity period.
// TODO(torbjorng): Now that Generate() accepts relevant params, make tests // TODO(torbjorng): Now that Generate() accepts relevant params, make tests