Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: crypto/rsa_private_key_openssl.cc

Issue 559623002: Allow a crypto::RSAPrivateKey object to be wrapped round a pre-existing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ouch, try again for the neither NSS nor openssl case Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crypto/rsa_private_key_nss_unittest.cc ('k') | crypto/rsa_private_key_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
}
« no previous file with comments | « crypto/rsa_private_key_nss_unittest.cc ('k') | crypto/rsa_private_key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698