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

Unified Diff: base/crypto/rsa_private_key_win.cc

Issue 1558018: Implements support for PBKDF2-based key derivation, random key generation, an... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Style fixup Created 10 years, 9 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
« no previous file with comments | « base/crypto/rsa_private_key.h ('k') | base/crypto/scoped_capi_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/crypto/rsa_private_key_win.cc
===================================================================
--- base/crypto/rsa_private_key_win.cc (revision 43354)
+++ base/crypto/rsa_private_key_win.cc (working copy)
@@ -32,7 +32,8 @@
// The size is encoded as the upper 16 bits of the flags. :: sigh ::.
flags |= (num_bits << 16);
- if (!CryptGenKey(result->provider_, CALG_RSA_SIGN, flags, &result->key_))
+ if (!CryptGenKey(result->provider_, CALG_RSA_SIGN, flags,
+ result->key_.receive()))
return NULL;
return result.release();
@@ -95,8 +96,8 @@
READ_ASSERT(dest == blob.get() + blob_size);
if (!CryptImportKey(
- result->provider_, reinterpret_cast<uint8*>(public_key_struc), blob_size,
- NULL, CRYPT_EXPORTABLE, &result->key_)) {
+ result->provider_, reinterpret_cast<uint8*>(public_key_struc),
+ blob_size, NULL, CRYPT_EXPORTABLE, result->key_.receive())) {
return NULL;
}
@@ -106,19 +107,10 @@
RSAPrivateKey::RSAPrivateKey() : provider_(NULL), key_(NULL) {}
RSAPrivateKey::~RSAPrivateKey() {
- if (key_) {
- if (!CryptDestroyKey(key_))
- NOTREACHED();
- }
-
- if (provider_) {
- if (!CryptReleaseContext(provider_, 0))
- NOTREACHED();
- }
}
bool RSAPrivateKey::InitProvider() {
- return FALSE != CryptAcquireContext(&provider_, NULL, NULL,
+ return FALSE != CryptAcquireContext(provider_.receive(), NULL, NULL,
PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
}
« no previous file with comments | « base/crypto/rsa_private_key.h ('k') | base/crypto/scoped_capi_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698