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; |