[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-cryptoapi
Subject:    Re: CryptAcquireContext fails on Windows 98 with IE5
From:       Dr Stephen Henson <drh () CELOCOM ! COM>
Date:       1999-05-28 18:32:38
[Download RAW message or body]


Jerry Simington wrote:
>
> The following call fails on Windows 98 with IE5
>
> CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0)
>
> GetLastError() returns "Regestry key entry container could not be opened and
> may not exist."
> The documentation states that CryptoAPI ships with Windows 95 SR2 or Windows
> 95 with IE3. I assume the Windows 98 has it too. But why does this call
> fail.
>

The problem here is that the CryptAcquireContext() call is trying to
open the default key container (using the current user name). If you
don't have a default key container then it fails.

If you don't want to try to open the default key container you can pass
the argument CRYPT_VERIFYCONTEXT as the last argument with a NULL
container name.

You can then, for example, use the context to work out what key
containers are there and then make another CryptAcquireContext() call
without this flag with a valid container name.

Steve.
--
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: shenson@drh-consultancy.demon.co.uk
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: drh@celocom.com PGP key: via homepage.

----------------------------------------------------------------
Users Guide http://msdn.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic