Discussion:
problem with CryptAcquireContext
(too old to reply)
Joe
2005-09-15 02:57:09 UTC
Permalink
Hi all,



I am currently using the CryptAcquireContext function to acquire a handle to
a particular key container within a particular CSP.



If I just use the default key container and CSP then the function can return
the handle no problem



CryptAcquireContext(&hCryptProv, NULL, NULL ,PROV_RSA_FULL, 0)



However, if I try to use a specific CSP and a specific container then I get
the following errors



1) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
Cryptographic Provider" ,PROV_RSA_FULL, 0):

error number "80090019" (NTE_KEYSET_NOT_DEF)



2) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
Cryptographic Provider" ,PROV_RSA_FULL, CRYPT_MACHINE_KEYSET):

error number "80090016" (NTE_BAD_KEYSET)



3) Try to create a default container:

CryptAcquireContext(&hCryptProv, NULL, "Eracom RSA Full Cryptographic
Provider" ,PROV_RSA_FULL, CRYPT_NEWKEYSET):

error number "80090019"





When I use CryptEnumProviders() to enumerate the available providers, the
"Eracom RSA Full Cryptographic Provider" was listed.



Any help would be greatly appreciated.



Joe
Jan Spooren
2005-09-15 06:20:55 UTC
Permalink
Hi Joe,
Post by Joe
However, if I try to use a specific CSP and a specific container then I
1) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
error number "80090019" (NTE_KEYSET_NOT_DEF)
2) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
error number "80090016" (NTE_BAD_KEYSET)
CryptAcquireContext(&hCryptProv, NULL, "Eracom RSA Full Cryptographic
error number "80090019"
When I use CryptEnumProviders() to enumerate the available providers, the
"Eracom RSA Full Cryptographic Provider" was listed.
Any help would be greatly appreciated.
As you might have guessed, these errors are generated by this particular CSP
and it might be best to contact technical support at Eracom.

I would guess that this CSP does not support default keysets. Have you
tried creating another, non-default keyset, like so:

CryptAcquireContext(&hCryptProv, "My Own Key Container", "Eracom RSA Full
Cryptographic Provider" ,PROV_RSA_FULL, CRYPT_NEWKEYSET):

In principle, applications are not supposed to use the default key
container, as this might interfere with other application using the same key
container. It's best to use a key container name which is unique to your
application (such as a GUID).

Cheers,
Jan.
Joe
2005-09-15 08:52:25 UTC
Permalink
Hi Jan,



Thanks for the reply.



I tried your suggestion



CryptAcquireContext(&hCryptProv, "Test3_Container", "Eracom RSA Full
Cryptographic Provider" ,PROV_RSA_FULL, CRYPT_NEWKEYSET):



The error number is still "80090019" (NTE_KEYSET_NOT_DEF)



I found this from the MSDN.



NTE_KEYSET_NOT_DEF (0x80090019)

¡E
The Crypto Service Provider (CSP) may not be set up correctly. Use of
Regsvr32.exe on CSP DLLs (Rsabase.dll or Rsaenh.dll) may fix the problem,
depending on the provider being used.




http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B238187



But Regsvr32.exe didn't help. How can I make sure that the CSP is set up
correctly?



Thank you.



Joe
Post by Jan Spooren
Hi Joe,
Post by Joe
However, if I try to use a specific CSP and a specific container then I
1) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
error number "80090019" (NTE_KEYSET_NOT_DEF)
2) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
error number "80090016" (NTE_BAD_KEYSET)
CryptAcquireContext(&hCryptProv, NULL, "Eracom RSA Full Cryptographic
error number "80090019"
When I use CryptEnumProviders() to enumerate the available providers, the
"Eracom RSA Full Cryptographic Provider" was listed.
Any help would be greatly appreciated.
As you might have guessed, these errors are generated by this particular
CSP and it might be best to contact technical support at Eracom.
I would guess that this CSP does not support default keysets. Have you
CryptAcquireContext(&hCryptProv, "My Own Key Container", "Eracom RSA Full
In principle, applications are not supposed to use the default key
container, as this might interfere with other application using the same
key container. It's best to use a key container name which is unique to
your application (such as a GUID).
Cheers,
Jan.
lelteto
2005-09-16 14:46:05 UTC
Permalink
it sounds this is a CSP specific problem. Contact their tech support...

Laszlo Elteto
SafeNet, Inc.
Post by Joe
Hi Jan,
Thanks for the reply.
I tried your suggestion
CryptAcquireContext(&hCryptProv, "Test3_Container", "Eracom RSA Full
The error number is still "80090019" (NTE_KEYSET_NOT_DEF)
I found this from the MSDN.
NTE_KEYSET_NOT_DEF (0x80090019)
¡E
The Crypto Service Provider (CSP) may not be set up correctly. Use of
Regsvr32.exe on CSP DLLs (Rsabase.dll or Rsaenh.dll) may fix the problem,
depending on the provider being used.
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B238187
But Regsvr32.exe didn't help. How can I make sure that the CSP is set up
correctly?
Thank you.
Joe
Post by Jan Spooren
Hi Joe,
Post by Joe
However, if I try to use a specific CSP and a specific container then I
1) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
error number "80090019" (NTE_KEYSET_NOT_DEF)
2) CryptAcquireContext(&hCryptProv, "User1_Container", "Eracom RSA Full
error number "80090016" (NTE_BAD_KEYSET)
CryptAcquireContext(&hCryptProv, NULL, "Eracom RSA Full Cryptographic
error number "80090019"
When I use CryptEnumProviders() to enumerate the available providers, the
"Eracom RSA Full Cryptographic Provider" was listed.
Any help would be greatly appreciated.
As you might have guessed, these errors are generated by this particular
CSP and it might be best to contact technical support at Eracom.
I would guess that this CSP does not support default keysets. Have you
CryptAcquireContext(&hCryptProv, "My Own Key Container", "Eracom RSA Full
In principle, applications are not supposed to use the default key
container, as this might interfere with other application using the same
key container. It's best to use a key container name which is unique to
your application (such as a GUID).
Cheers,
Jan.
Loading...