Har sökt på nätet efter VB deklarationer för API'erna i Crypt32 library. Vill ogärna behöva göra detta själv om det finns färdigt. Kan dock inte hitta det. Testa de här:Crypt32 / wincrypt.h VB API deklarationer
Någon som sett detta nånstans?
/SmutsSv: Crypt32 / wincrypt.h VB API deklarationer
Det finns ett helt gäng med konstanter också, men det blir jättelångt om jag ska med alla, kolla på:
http://www.apress.com/article/articleDisplay.html?aID=12&pn=1
så finns det lite källkod du kan titta på.
'********************************************************
Public Type PROV_ENUMALGS
aiAlgid As Long
dwBitLen As Long
dwNameLen As Long
szName As String * 20
End Type
Public Type PROV_ENUMALGS_EX
aiAlgid As Long
dwDefaultLen As Long
dwMinLen As Long
dwMaxLen As Long
dwProtocols As Long
dwNameLen As Long
szName As String * 20
dwLongNameLen As Long
szLongName As String * 40
End Type
' CryptoAPI Methods.
Public Declare Function CryptAcquireContext Lib "advapi32.dll" Alias "CryptAcquireContextA" (phProv As Long, ByVal pszContainer As String, ByVal pszProvider As String, ByVal dwProvType As Long, ByVal dwFlags As Long) As Long
Public Declare Function CryptCreateHash Lib "advapi32.dll" (ByVal hProv As Long, ByVal AlgId As Long, ByVal hKey As Long, ByVal dwFlags As Long, phHash As Long) As Long
Public Declare Function CryptDecrypt Lib "advapi32.dll" (ByVal hKey As Long, ByVal hHash As Long, ByVal Final As Long, ByVal dwFlags As Long, pbData As Any, pdwDataLen As Long) As Long
Public Declare Function CryptDeriveKey Lib "advapi32.dll" (ByVal hProv As Long, ByVal AlgId As Long, ByVal hBaseData As Long, ByVal dwFlags As Long, phKey As Long) As Long
Public Declare Function CryptDestroyHash Lib "advapi32.dll" (ByVal hHash As Long) As Long
Public Declare Function CryptDestroyKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Public Declare Function CryptEncrypt Lib "advapi32.dll" (ByVal hKey As Long, ByVal hHash As Long, ByVal Final As Long, ByVal dwFlags As Long, pbData As Any, pdwDataLen As Long, ByVal dwBufLen As Long) As Long
Public Declare Function CryptEnumProviders Lib "advapi32.dll" Alias "CryptEnumProvidersA" (ByVal dwIndex As Long, ByVal pdwReserved As Long, ByVal dwFlags As Long, pdwProvType As Long, ByVal pszProvName As String, pcbProvName As Long) As Long
Public Declare Function CryptExportKey Lib "advapi32.dll" (ByVal hKey As Long, ByVal hExpKey As Long, ByVal dwBlobType As Long, ByVal dwFlags As Long, pbData As Any, pdwDataLen As Long) As Long
Public Declare Function CryptGetDefaultProvider Lib "advapi32.dll" (ByVal dwProvType As Long, pdwReserved As Long, ByVal dwFlags As Long, ByVal pszProvName As String, pcbProvName As Long) As Long
Public Declare Function CryptGenKey Lib "advapi32.dll" (ByVal hProv As Long, ByVal AlgId As Long, ByVal dwFlags As Long, phKey As Long) As Long
Public Declare Function CryptGetHashParam Lib "advapi32.dll" (ByVal hHash As Long, ByVal dwParam As Long, pbData As Any, pcbData As Long, ByVal dwFlags As Long) As Long
Public Declare Function CryptGetKeyParam Lib "advapi32.dll" (ByVal hCryptKey As Long, ByVal dwParam As Long, pbData As Any, pcbData As Long, ByVal dwFlags As Long) As Long
Public Declare Function CryptGetProvParam Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwParam As Long, pbData As Any, pdwDataLen As Long, ByVal dwFlags As Long) As Long
Public Declare Function CryptGetUserKey Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwKeySpec As Long, phUserKey As Long) As Long
Public Declare Function CryptHashData Lib "advapi32.dll" (ByVal hHash As Long, pbData As Any, ByVal dwDataLen As Long, ByVal dwFlags As Long) As Long
Public Declare Function CryptImportKey Lib "advapi32.dll" (ByVal hProv As Long, pbData As Any, ByVal dwDataLen As Long, ByVal hPubKey As Long, ByVal dwFlags As Long, phKey As Long) As Long
Public Declare Function CryptReleaseContext Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwFlags As Long) As Long
Public Declare Function CryptSetHashParam Lib "advapi32.dll" (ByVal hHash As Long, ByVal dwParam As Long, pbData As Any, ByVal dwFlags As Long) As Long
Public Declare Function CryptSetKeyParam Lib "advapi32.dll" (ByVal hKey As Long, ByVal dwParam As Long, pbData As Any, ByVal dwFlags As Long) As Long
Public Declare Function CryptSetProvParam Lib "advapi32.dll" (ByVal hProv As Long, ByVal dwParam As Long, pbData As Any, ByVal dwFlags As Long) As Long
Public Declare Function CryptSignHash Lib "advapi32.dll" Alias "CryptSignHashA" (ByVal hHash As Long, ByVal dwKeySpec As Long, ByVal sDescription As String, ByVal dwFlags As Long, pbSignature As Any, pdwSigLen As Long) As Long
Public Declare Function CryptVerifySignature Lib "advapi32.dll" Alias "CryptVerifySignatureA" (ByVal hHash As Long, pbSignature As Any, ByVal dwSigLen As Long, ByVal hPubKey As Long, ByVal sDescription As String, ByVal dwFlags As Long) As Long
Public Declare Function DecryptFile Lib "advapi32.dll" Alias "DecryptFileA" (ByVal lpFileName As String, ByVal dwReserved As Long) As Long
Public Declare Function EncryptFile Lib "advapi32.dll" Alias "EncryptFileA" (ByVal lpFileName As String) As Long
'********************************************************
/Anders