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
"xinwei chai" <chaix...@netzero.net> wrote in message
news:083901c345d6$e2330c20$a301...@phx.gbl...
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.
-
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...