RE: CryptAcquireContext failed for non-interactive user



You can only use it with CRYPT_MACHINE_KEYSET, otherwise it will try to open
the current user's crypto store. Or you can just create a temp context with
CRYPT_VERIFYCONTEXT.

Laszlo Elteto
SafeNet, Inc.

"dimi" wrote:

Hi all,
i have a problem when using CryptAcquireContext in application which
is started from service.
CryptAcquireContext failed with 0x80090020 - An internal error
occurred
The same application works fine when it is started from command
prompt.
As i see it can work and from service but for that i should change my
service to run under "Interactive user" or to make LogonUser in this
application with LOGON32_LOGON_INTERACTIVE

Is there any idea what to do and where can be the problem, because i
don't like the above workarounds.
CryptAcquireContext work fine and when my service is started with
Local Service account but in this case i have problem to reach private
keys on smart card.

OS is Windows server 2003, under XP all is OK.

Thanks in advance


.