I guess you have an error message from CryptAcquireCertificatePrivateKey.
With my posted code above, what if you try...
With my posted code above, what if you try...
Code:
'Insert this just above "IF pDesiredCert THEN CertFreeCertificateContext(pDesiredCert)" line. IF pDesiredCert THEN 'CryptAcquireCertificatePrivateKey LOCAL RetVal AS LONG LOCAL hProv AS DWORD LOCAL dwKeySpec AS DWORD LOCAL pfCallerFreeProv AS DWORD RetVal = CryptAcquireCertificatePrivateKey(pDesiredCert, %NULL, %NULL, hProv, dwKeySpec, pfCallerFreeProv) dwLastError = GetLastError() MessageBox(%HWND_DESKTOP, "Note: CryptAcquireCertificatePrivateKey" & $CRLF & _ "can only be used by the owner of a private key." & $CRLF & $CRLF & _ "hProv " & $TAB & "0x" & HEX$(hProv) & $CRLF & _ "dwKeySpec " & $TAB & "0x" & HEX$(dwKeySpec) & $CRLF & _ "pfCallerFreeProv " & $TAB & "0x" & HEX$(pfCallerFreeProv) & $CRLF & _ "RetVal " & $TAB & FORMAT$(RetVal) & $CRLF & _ WinError$(dwLastError), "PrivateKey", %MB_OK OR %MB_SYSTEMMODAL OR %MB_TOPMOST) END IF
Comment