CryptAcquireContext and GINA
From: Sergio G. (sgmartin_at_digi-sign-p.com)
Date: 09/30/05
- Previous message: Rhett Gong [MSFT]: "Re: AcquireCredentialsHandle returns with SEC_E_INTERNAL_ERROR"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 30 Sep 2005 12:29:58 +0200
Hi all,
I'm writting a custom GINA wich allows a user to unlock his computer
verifying the PIN of a SmartCard.
For getting this to work I call CryptAcquireContext passing the CSP name and
type, with no container name and with CRYPT_SILENT flags.
CryptAcquireContext(
&hCryptProv,
NULL,
CSPname,
CSP_TYPE,
CRYPT_SILENT )
I use CRYPT_SILENT because I do not want the CSP to show its custom dialog
to ask for the pin.
Then I call CryptSetProvParam passing the user PIN to check it, and
CryptReleaseContext to finish.
CryptSetProvParam(
hCryptProv,
PP_SIGNATURE_PIN,
userPIN,
0)
This code works ok when ran outside the GINA, but fails when ran on it,
getting NTE_BAD_KEYSET error in CryptAcquireContext. I guess this is a
container access problem so I have added CRYPT_VERIFYCONTEXT flag to the
call to CryptAcquireContext, but the error remains the same.
Any ideas of what might be happening?
Also, does any know a better way to check the PIN of a smart card?
Thanks in advance,
Sergio.
- Previous message: Rhett Gong [MSFT]: "Re: AcquireCredentialsHandle returns with SEC_E_INTERNAL_ERROR"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|