summaryrefslogtreecommitdiffstats
path: root/engines
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2012-11-18 15:20:49 +0000
committerDr. Stephen Henson <steve@openssl.org>2012-11-18 15:20:49 +0000
commitfb81e6d3009106bd88f1064ff9c8fa5fdec3a19f (patch)
tree9105fd1f427bf1bfbc7f5804530514938df362af /engines
parent50ff4afb03ed5e1782597e7cc3fc7faa5c721fd6 (diff)
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')
-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 fa0624f145..8b7e25815c 100644
--- a/engines/e_capi.c
+++ b/engines/e_capi.c
@@ -1431,10 +1431,13 @@ static PCCERT_CONTEXT capi_find_cert(CAPI_CTX *ctx, const char *id, HCERTSTORE h
static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const char *contname, char *provname, DWORD ptype, DWORD keyspec)
{
CAPI_KEY *key;
+ DWORD dwFlags = 0;
key = OPENSSL_malloc(sizeof(CAPI_KEY));
CAPI_trace(ctx, "capi_get_key, contname=%s, provname=%s, type=%d\n",
contname, provname, ptype);
- if (!CryptAcquireContextA(&key->hprov, contname, provname, ptype, 0))
+ if(ctx->store_flags & CERT_SYSTEM_STORE_LOCAL_MACHINE)
+ dwFlags = CRYPT_MACHINE_KEYSET;
+ if (!CryptAcquireContextA(&key->hprov, contname, provname, ptype, dwFlags))
{
CAPIerr(CAPI_F_CAPI_GET_KEY, CAPI_R_CRYPTACQUIRECONTEXT_ERROR);
capi_addlasterror();