diff options
Diffstat (limited to 'crypto/rsa_private_key_mac.cc')
-rw-r--r-- | crypto/rsa_private_key_mac.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crypto/rsa_private_key_mac.cc b/crypto/rsa_private_key_mac.cc index 85dadfa..8dcf14a 100644 --- a/crypto/rsa_private_key_mac.cc +++ b/crypto/rsa_private_key_mac.cc @@ -174,17 +174,24 @@ RSAPrivateKey::~RSAPrivateKey() { } } -bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) { +RSAPrivateKey* RSAPrivateKey::Copy() const { + std::vector<uint8> key_bytes; + if (!ExportPrivateKey(&key_bytes)) + return NULL; + return CreateFromPrivateKeyInfo(key_bytes); +} + +bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) const { 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; } -bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) { +bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) const { PrivateKeyInfoCodec private_key_info(true); std::vector<uint8> private_key_data; private_key_data.assign(key_.KeyData.Data, |