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

List:       ms-cryptoapi
Subject:    failed to acquire a handle to the DEFAULT  key container
From:       Andrew Teoh <andrew_tbj () HOTMAIL ! COM>
Date:       2001-11-15 8:54:18
[Download RAW message or body]


Hi,
I'm trying to create a simple encryption and decryption programe using
CryptoAPI in VB, it runs fine in desktop version under win 98 and win 2000
professional.

But the problem occured when i converted it into activeX dll (com object)
which embeded into ASP file. When I ran the asp file, the error message
showed it failed to acquire a handle to the DEFAULT (56-bit) key container
in IIS, win 2000. But it worked fine in PWS win98.

The code is in below:

Private m_lngCryptContext  As Long
Private strTmp As String = ""
Dim strProvider2  As String
strProvider2 = MS_DEFAULT_PROVIDER & vbNullChar

If Not CBool(CryptAcquireContext(m_lngCryptContext, strTmp, strProvider2,
PROV_RSA_FULL, 0)) Then
      ' Create default key container.
      If Not CBool(CryptAcquireContext(m_lngCryptContext, strTmp,
strProvider2, PROV_RSA_FULL, CRYPT_NEWKEYSET)) Then
          strErrorMsg = "Error creating DEFAULT key container - " &
CStr(Err.LastDllError)
          m_ErrInit = strErrorMsg
          Initialize_CryptoAPI = False
          Exit Function
      End If
  End If

I have given all neccesary full control right to internet user account but
it was still failed.

Please help,

Thank you

Regards,
Andrew


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:CryptoAPI-signoff-request@DISCUSS.MICROSOFT.COM

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

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