Index: crypto/rsa_private_key_nss.cc |
diff --git a/crypto/rsa_private_key_nss.cc b/crypto/rsa_private_key_nss.cc |
index 3b8bd4489a2446265d54cebe845b5fe1947ffc29..30152283a686c5fc18a218237188a24aaea90d86 100644 |
--- a/crypto/rsa_private_key_nss.cc |
+++ b/crypto/rsa_private_key_nss.cc |
@@ -81,6 +81,17 @@ RSAPrivateKey* RSAPrivateKey::CreateSensitiveFromPrivateKeyInfo( |
} |
// static |
+RSAPrivateKey* RSAPrivateKey::CreateFromKey(SECKEYPrivateKey* key) { |
+ DCHECK(key); |
+ if (SECKEY_GetPrivateKeyType(key) != rsaKey) |
+ return NULL; |
+ RSAPrivateKey* copy = new RSAPrivateKey(); |
+ copy->key_ = SECKEY_CopyPrivateKey(key); |
+ copy->public_key_ = SECKEY_ConvertToPublicKey(key); |
+ return copy; |
Ryan Sleevi
2013/05/07 21:07:50
if (!copy->key_ || !copy->public_key_) {
NOTREAC
Chris Masone
2013/05/07 21:16:38
Done.
|
+} |
+ |
+// static |
RSAPrivateKey* RSAPrivateKey::FindFromPublicKeyInfo( |
const std::vector<uint8>& input) { |
EnsureNSSInit(); |