sslidentity.cc/IntKeyTypeFamilyToKeyType function added, converting from int to KeyType.

Added to prevent Chromium from breaking if KeyType (now an enum) starts being used in Chromium before KeyType changes to a parameterizable class. When enum -> class change happens, IntKeyTypeFamilyToKeyType will be updated at the same time.

Once Chromium starts using class KeyType with parameters this function can be removed.

R=tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#10013}
This commit is contained in:
Henrik Boström
2015-09-22 14:12:57 +02:00
parent ef165eefc7
commit 9b5476de9a
2 changed files with 12 additions and 3 deletions

View File

@ -39,6 +39,10 @@ const char kPemTypeCertificate[] = "CERTIFICATE";
const char kPemTypeRsaPrivateKey[] = "RSA PRIVATE KEY"; const char kPemTypeRsaPrivateKey[] = "RSA PRIVATE KEY";
const char kPemTypeEcPrivateKey[] = "EC PRIVATE KEY"; const char kPemTypeEcPrivateKey[] = "EC PRIVATE KEY";
KeyType IntKeyTypeFamilyToKeyType(int key_type_family) {
return static_cast<KeyType>(key_type_family);
}
bool SSLIdentity::PemToDer(const std::string& pem_type, bool SSLIdentity::PemToDer(const std::string& pem_type,
const std::string& pem_string, const std::string& pem_string,
std::string* der) { std::string* der) {

View File

@ -107,11 +107,16 @@ class SSLCertChain {
RTC_DISALLOW_COPY_AND_ASSIGN(SSLCertChain); RTC_DISALLOW_COPY_AND_ASSIGN(SSLCertChain);
}; };
// TODO(hbos, torbjorng): Don't change KT_DEFAULT without first // TODO(hbos,torbjorng): Don't change KT_DEFAULT without first updating
// updating PeerConnectionFactory_nativeCreatePeerConnection's certificate // PeerConnectionFactory_nativeCreatePeerConnection's certificate generation
// generation code. // code.
enum KeyType { KT_RSA, KT_ECDSA, KT_LAST, KT_DEFAULT = KT_RSA }; enum KeyType { KT_RSA, KT_ECDSA, KT_LAST, KT_DEFAULT = KT_RSA };
// TODO(hbos): Remove once rtc::KeyType (to be modified) and
// blink::WebRTCKeyType (to be landed) match. By using this function in Chromium
// appropriately we can change KeyType enum -> class without breaking Chromium.
KeyType IntKeyTypeFamilyToKeyType(int key_type_family);
// Parameters for generating an identity for testing. If common_name is // Parameters for generating an identity for testing. If common_name is
// non-empty, it will be used for the certificate's subject and issuer name, // non-empty, it will be used for the certificate's subject and issuer name,
// otherwise a random string will be used. |not_before| and |not_after| are // otherwise a random string will be used. |not_before| and |not_after| are