Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

keyset does not exist

140 views
Skip to first unread message

xinwei chai

unread,
Jul 9, 2003, 12:59:31 AM7/9/03
to
Hi,

I'm trying to use cryptAPI. By running the following line
----
if(!CryptAcquireContext(&hProv, NULL, MS_DEF_PROV,
PROV_RSA_FULL, 0)) {
----

I always got "keyset does not exist" error. What's the
matter?

Thanks a lot

Lauricarge

unread,
Jul 9, 2003, 5:15:18 AM7/9/03
to
May be keyset not exist
To create use CryptAcquireContext(&hProv, NULL, MS_DEF_PROV, PROV_RSA_FULL,
CRYPT_NEWKEYSET)

"xinwei chai" <chaix...@netzero.net> wrote in message
news:083901c345d6$e2330c20$a301...@phx.gbl...

Shell

unread,
Jul 9, 2003, 12:01:48 PM7/9/03
to
In responce to the post:
On Tue, 8 Jul 2003 21:59:31 -0700, "xinwei chai"
<chaix...@netzero.net> stated...and I replied:

2 things to consider here...

First, the second parameter is suppose to be a NULL terminated string
variable to indicate the Default container.

Second, instead of using the MS_DEF_PROV Const, try using NULL here to
force use of the Default provider.

If this returns False (meaning the default container does not exist),
then replace the last (0) parameter with CRYPT_NEWKEYSET.

Then use the CRYPTGETPROVPARAM function to obtain the container name.

HTH
Shell
-
http://drshell.home.mindspring.com/
Into computers since 1972.
WARNING! Information and e-mail addresses contained herein, are for personal use only. By entering this site, you agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to: allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via direct mail, electronic mail, or by telephone. Violators will be dealt with accordingly.
-

Sergio Dutra [MS]

unread,
Jul 15, 2003, 11:07:11 AM7/15/03
to
As one other post mentioned, use the CRYPT_NEWKEYSET flag if you get this
error initially. That will create a new keyset without any keys. You can
then use CryptGenKey to create a set of keys in that keyset. If you just
need to generate session keys and not a public/private key pair, use the
CRYPT_VERIFYCONTEXT flag instead of CRYPT_NEWKEYSET.

Also, it is unadvisable to use the NULL key container name. Any number of
applications may use that indiscriminately, which may result in possible
loss of data for your application if it depends on the default key
container. It's best for you to choose an unique container name.

Lastly, MS_DEF_PROV will point to the base provider, which has a limited key
strength. Instead, you can use NULL for the provider name to get the default
provider, although if your app is working on different O/S's these may be
different as well. You may opt to have a requirement of high key strength
being installed (default on WinME, Win2k, and later O/S's) and use
MS_ENHANCED_PROV.

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


"xinwei chai" <chaix...@netzero.net> wrote in message
news:083901c345d6$e2330c20$a301...@phx.gbl...

0 new messages