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

Unified Diff: crypto/rsa_private_key_mac.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_mac.cc
diff --git a/crypto/rsa_private_key_mac.cc b/crypto/rsa_private_key_mac.cc
index 85dadfa9ee67fe4df267514d845a48e2c4f9cd60..b9f0c45f0f2e9ca36422cbef97aa54dd8e0f36c0 100644
--- a/crypto/rsa_private_key_mac.cc
+++ b/crypto/rsa_private_key_mac.cc
@@ -174,13 +174,20 @@ RSAPrivateKey::~RSAPrivateKey() {
}
}
+RSAPrivateKey* RSAPrivateKey::Copy() const {
+ std::vector<uint8> key_bytes;
+ if (!key_->ExportPrivateKey(&key_bytes))
+ return false;
+ return CreateFromPrivateKeyInfo(key_bytes);
+}
+
bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) {
if (!key_.KeyData.Data || !key_.KeyData.Length) {
return false;
}
output->clear();
output->insert(output->end(), key_.KeyData.Data,
- key_.KeyData.Data + key_.KeyData.Length);
+ key_.KeyData.Data + key_.KeyData.Length);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698