Index: crypto/rsa_private_key_openssl.cc |
diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc |
index 8dcde61628f58b6f83859959c5d933b9c5ae1731..053c4a2f930d1e15fa8a971b41e36b533c2bae8a 100644 |
--- a/crypto/rsa_private_key_openssl.cc |
+++ b/crypto/rsa_private_key_openssl.cc |
@@ -98,6 +98,16 @@ RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfo( |
return result.release(); |
} |
+// static |
+RSAPrivateKey* RSAPrivateKey::CreateFromKey(EVP_PKEY* key) { |
+ DCHECK(key); |
+ if (EVP_PKEY_type(key->type) != EVP_PKEY_RSA) |
+ return NULL; |
+ RSAPrivateKey* copy = new RSAPrivateKey(); |
+ copy->key_ = EVP_PKEY_dup(key); |
+ return copy; |
+} |
+ |
RSAPrivateKey::RSAPrivateKey() |
: key_(NULL) { |
} |