From 34b5ba3b6010f792e66cf347fbd350cd2674bd29 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sun, 18 Nov 2012 15:20:40 +0000 Subject: [PATCH] =?utf8?q?PR:=202880=20Submitted=20by:=20"Florian=20R?= =?utf8?q?=C3=83=C2=BCchel"=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Correctly handle local machine keys in the capi ENGINE. --- engines/e_capi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/e_capi.c b/engines/e_capi.c index 9f38af3b22..e332fb84ee 100644 --- a/engines/e_capi.c +++ b/engines/e_capi.c @@ -1409,10 +1409,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(); -- 2.25.1