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

Unified Diff: crypto/ec_private_key_openssl.cc

Issue 205333002: Hack to allow ec_private_key_openssl loading keys generated with NSS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | « no previous file | crypto/ec_private_key_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/ec_private_key_openssl.cc
diff --git a/crypto/ec_private_key_openssl.cc b/crypto/ec_private_key_openssl.cc
index ce921dde15f6d1d96e46e286d2f45eb95440ee16..8504ab50c357ceb2b2f9afffc4dbb63c242fd84f 100644
--- a/crypto/ec_private_key_openssl.cc
+++ b/crypto/ec_private_key_openssl.cc
@@ -132,6 +132,11 @@ ECPrivateKey* ECPrivateKey::CreateFromEncryptedPrivateKeyInfo(
PKCS8_decrypt(p8_encrypted.get(),
password.c_str(),
static_cast<int>(password.size())));
+ if (!p8_decrypted.get() && password.empty()) {
+ // Hack for reading keys generated by ec_private_key_nss. Passing NULL
+ // causes OpenSSL to use an empty password instead of "\0\0".
wtc 2014/03/22 03:13:45 Does NSS have a bug?
mattm 2014/03/22 04:01:34 I don't know I'd call it a bug in NSS, other than
+ p8_decrypted.reset(PKCS8_decrypt(p8_encrypted.get(), NULL, 0));
+ }
if (!p8_decrypted.get())
return NULL;
« no previous file with comments | « no previous file | crypto/ec_private_key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698