Index: crypto/rsa_private_key_nss.cc |
diff --git a/crypto/rsa_private_key_nss.cc b/crypto/rsa_private_key_nss.cc |
index cd1f9203f3517b1cbe4451ab9700803d52c055fd..3b8bd4489a2446265d54cebe845b5fe1947ffc29 100644 |
--- a/crypto/rsa_private_key_nss.cc |
+++ b/crypto/rsa_private_key_nss.cc |
@@ -138,8 +138,14 @@ RSAPrivateKey* RSAPrivateKey::FindFromPublicKeyInfo( |
return NULL; |
} |
+RSAPrivateKey* RSAPrivateKey::Copy() const { |
+ RSAPrivateKey* copy = new RSAPrivateKey(); |
+ copy->key_ = SECKEY_CopyPrivateKey(key_); |
+ copy->public_key_ = SECKEY_CopyPublicKey(public_key_); |
+ return copy; |
+} |
-bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) { |
+bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) const { |
PrivateKeyInfoCodec private_key_info(true); |
// Manually read the component attributes of the private key and build up |
@@ -161,7 +167,7 @@ bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) { |
return private_key_info.Export(output); |
} |
-bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) { |
+bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) const { |
ScopedSECItem der_pubkey(SECKEY_EncodeDERSubjectPublicKeyInfo(public_key_)); |
if (!der_pubkey.get()) { |
NOTREACHED(); |