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

Unified Diff: crypto/rsa_private_key_openssl.cc

Issue 18697003: Introduce RSAPrivateKey::SignDigest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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
« crypto/rsa_private_key.h ('K') | « crypto/rsa_private_key_nss.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/rsa_private_key_openssl.cc
diff --git a/crypto/rsa_private_key_openssl.cc b/crypto/rsa_private_key_openssl.cc
index f191e393288372c98e4ec379f3408224d09b7480..4bdede0aa8949313d807a980d31f8e47fb6a7cd3 100644
--- a/crypto/rsa_private_key_openssl.cc
+++ b/crypto/rsa_private_key_openssl.cc
@@ -123,4 +123,15 @@ bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) const {
return ExportKey(key_, i2d_PUBKEY_bio, output);
}
+bool RSAPrivateKey::SignDigest(const std::vector<uint8>& digest,
+ std::vector<uint8>* output) const {
+ RSA* rsa = EVP_PKEY_get1_RSA(key_);
+ if (!rsa)
+ return false;
+ output->resize(RSA_size(rsa));
+ unsigned int size;
+ return RSA_sign(NID_sha1, &digest[0], digest.size(), &(*output)[0], &size,
+ rsa);
+}
+
} // namespace crypto
« crypto/rsa_private_key.h ('K') | « crypto/rsa_private_key_nss.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698