| Index: crypto/rsa_private_key_win.cc
|
| diff --git a/crypto/rsa_private_key_win.cc b/crypto/rsa_private_key_win.cc
|
| index f7363422db8b18928e95c8b2bd98690a0bc7f3d4..d87c1ec058a79f849b22bc33482842c85d67d2ca 100644
|
| --- a/crypto/rsa_private_key_win.cc
|
| +++ b/crypto/rsa_private_key_win.cc
|
| @@ -134,7 +134,19 @@ bool RSAPrivateKey::InitProvider() {
|
| PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
|
| }
|
|
|
| -bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) {
|
| +RSAPrivateKey* RSAPrivateKey::Copy() const {
|
| + scoped_ptr<RSAPrivateKey> copy(new RSAPrivateKey());
|
| + if (!CryptContextAddRef(provider_, NULL, 0)) {
|
| + NOTREACHED();
|
| + return NULL;
|
| + }
|
| + copy->provider_.reset(provider_.get());
|
| + if (!CryptDuplicateKey(key_.get(), NULL, 0, copy->key_.receive()))
|
| + return NULL;
|
| + return copy.release();
|
| +}
|
| +
|
| +bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) const {
|
| // Export the key
|
| DWORD blob_length = 0;
|
| if (!CryptExportKey(key_, 0, PRIVATEKEYBLOB, 0, NULL, &blob_length)) {
|
| @@ -187,7 +199,7 @@ bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) {
|
| return pki.Export(output);
|
| }
|
|
|
| -bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) {
|
| +bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) const {
|
| DWORD key_info_len;
|
| if (!CryptExportPublicKeyInfo(
|
| provider_, AT_SIGNATURE, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
|
|
|