aboutsummaryrefslogtreecommitdiffstats
path: root/engines/e_capi.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2012-11-18 15:24:37 +0000
committerDr. Stephen Henson <steve@openssl.org>2012-11-18 15:24:37 +0000
commitc4fc172240b867350967ee50734267c402450e19 (patch)
tree2cdb018893cd002bdc43f2f131e790f469d9d235 /engines/e_capi.c
parentd88926f1815d79c800e4cf11ecee8e43f3a7ad1f (diff)
downloadopenssl-c4fc172240b867350967ee50734267c402450e19.tar.gz
PR: 2880
Submitted by: "Florian Rüchel" <florian.ruechel@ruhr-uni-bochum.de> Correctly handle local machine keys in the capi ENGINE.
Diffstat (limited to 'engines/e_capi.c')
-rw-r--r--engines/e_capi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/e_capi.c b/engines/e_capi.c
index 791629f083..fff8e6a14f 100644
--- a/engines/e_capi.c
+++ b/engines/e_capi.c
@@ -1460,6 +1460,7 @@ static PCCERT_CONTEXT capi_find_cert(CAPI_CTX *ctx, const char *id, HCERTSTORE h
static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const TCHAR *contname, TCHAR *provname, DWORD ptype, DWORD keyspec)
{
CAPI_KEY *key;
+ DWORD dwFlags = 0;
key = OPENSSL_malloc(sizeof(CAPI_KEY));
if (sizeof(TCHAR)==sizeof(char))
CAPI_trace(ctx, "capi_get_key, contname=%s, provname=%s, type=%d\n",
@@ -1475,7 +1476,9 @@ static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const TCHAR *contname, TCHAR *provn
if (_provname) OPENSSL_free(_provname);
if (_contname) OPENSSL_free(_contname);
}
- if (!CryptAcquireContext(&key->hprov, contname, provname, ptype, 0))
+ if(ctx->store_flags & CERT_SYSTEM_STORE_LOCAL_MACHINE)
+ dwFlags = CRYPT_MACHINE_KEYSET;
+ if (!CryptAcquireContext(&key->hprov, contname, provname, ptype, dwflags))
{
CAPIerr(CAPI_F_CAPI_GET_KEY, CAPI_R_CRYPTACQUIRECONTEXT_ERROR);
capi_addlasterror();