Index: crypto/ec_private_key.h |
diff --git a/crypto/ec_private_key.h b/crypto/ec_private_key.h |
index 0d287de9cc05949236f4c6bff5cf037b6a6f40d9..44f754b038c9e30d45dec3545b4779f4c1759b1a 100644 |
--- a/crypto/ec_private_key.h |
+++ b/crypto/ec_private_key.h |
@@ -18,6 +18,7 @@ |
typedef struct evp_pkey_st EVP_PKEY; |
#else |
// Forward declaration. |
+typedef struct CERTSubjectPublicKeyInfoStr CERTSubjectPublicKeyInfo; |
typedef struct SECKEYPrivateKeyStr SECKEYPrivateKey; |
typedef struct SECKEYPublicKeyStr SECKEYPublicKey; |
#endif |
@@ -65,6 +66,22 @@ class CRYPTO_EXPORT ECPrivateKey { |
const std::vector<uint8>& encrypted_private_key_info, |
const std::vector<uint8>& subject_public_key_info); |
+#if !defined(USE_OPENSSL) |
+ // Imports the key pair and returns in |public_key| and |key|. |
+ // Shortcut for code that needs to keep a reference directly to NSS types |
+ // without having to create a ECPrivateKey object and make a copy of them. |
+ // TODO(mattm): move this function to some NSS util file. |
+ static bool ImportFromEncryptedPrivateKeyInfo( |
+ const std::string& password, |
+ const uint8* encrypted_private_key_info, |
+ size_t encrypted_private_key_info_len, |
+ CERTSubjectPublicKeyInfo* decoded_spki, |
+ bool permanent, |
+ bool sensitive, |
+ SECKEYPrivateKey** key, |
+ SECKEYPublicKey** public_key); |
+#endif |
+ |
#if defined(USE_OPENSSL) |
EVP_PKEY* key() { return key_; } |
#else |