My primary use of this class is in an Access db with vba. Your class works for me through most of my environments, however..
I have two windows 7 machines and an xp machine. On one of the windows 7 machines the class fails during initialization on this line as a class within the Access db:
Vb Code:
ElseIf CryptAcquireContext(hAdvProvider, _
0&, _
StrPtr(strProvider), _
PROV_RSA_AES, _
CRYPT_VERIFYCONTEXT) = 0 Then
Err.Raise vbObjectError Or &HC368&, _
"HS256.Class_Initialize", _
"Failed to obtain CryptoAPI RSA AES context, system error " _
& CStr(Err.LastDllError)
End If
However, your vb6 demo works fine on the same machine.
The class also works within the Access db on the other windows 7 machine and on the xp machine.
So it seems it can create a base provider but not an advanced provider (from within the Access Db):
Vb Code:
If CryptAcquireContext(hBaseProvider, _
0&, _
StrPtr(MS_DEFAULT_PROVIDER), _
PROV_RSA_FULL, _
CRYPT_VERIFYCONTEXT) = 0 Then
Err.Raise vbObjectError Or &HC366&, _
"HS256.Class_Initialize", _
"Failed to obtain CryptoAPI Base context, system error " _
& CStr(Err.LastDllError)
ElseIf CryptAcquireContext(hAdvProvider, _
0&, _
StrPtr(strProvider), _
PROV_RSA_AES, _
CRYPT_VERIFYCONTEXT) = 0 Then
Err.Raise vbObjectError Or &HC368&, _
"HS256.Class_Initialize", _
"Failed to obtain CryptoAPI RSA AES context, system error " _
& CStr(Err.LastDllError)
End If
Any guesses as to what the cause of this would be? Maybe a missing win7 service pack?
Thanks - and much appreciated!