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

Unified Diff: crypto/rsa_private_key_win.cc

Issue 8727014: Implement RSAPrivateKey::Copy() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month 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
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..c07e2239b35aeadc5b33bd231796f01b2545612f 100644
--- a/crypto/rsa_private_key_win.cc
+++ b/crypto/rsa_private_key_win.cc
@@ -134,6 +134,14 @@ bool RSAPrivateKey::InitProvider() {
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
}
+RSAPrivateKey* RSAPrivateKey::Copy() const {
+ scoped_ptr<RSAPrivateKey> copy(new RSAPrivateKey());
+ copy->provider_ = CryptContextAddRef(provider_, NULL, 0);
+ if (!CryptDuplicateKey(key_.get(), NULL, 0, copy->key_.receive()))
+ return NULL;
+ return copy.release();
+}
+
bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) {
// Export the key
DWORD blob_length = 0;

Powered by Google App Engine
This is Rietveld 408576698