PR: 2880
Submitted by: "Florian Rüchel" <florian.ruechel@ruhr-uni-bochum.de> Correctly handle local machine keys in the capi ENGINE.
This commit is contained in:
parent
50ff4afb03
commit
fb81e6d300
@ -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)
|
static CAPI_KEY *capi_get_key(CAPI_CTX *ctx, const char *contname, char *provname, DWORD ptype, DWORD keyspec)
|
||||||
{
|
{
|
||||||
CAPI_KEY *key;
|
CAPI_KEY *key;
|
||||||
|
DWORD dwFlags = 0;
|
||||||
key = OPENSSL_malloc(sizeof(CAPI_KEY));
|
key = OPENSSL_malloc(sizeof(CAPI_KEY));
|
||||||
CAPI_trace(ctx, "capi_get_key, contname=%s, provname=%s, type=%d\n",
|
CAPI_trace(ctx, "capi_get_key, contname=%s, provname=%s, type=%d\n",
|
||||||
contname, provname, ptype);
|
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);
|
CAPIerr(CAPI_F_CAPI_GET_KEY, CAPI_R_CRYPTACQUIRECONTEXT_ERROR);
|
||||||
capi_addlasterror();
|
capi_addlasterror();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user