Returns the message digest hash of the PKCS #7 issuerAndSerialNumber value of an X.509 certificate in hexadecimal format.
Public Declare Function X509_HashIssuerAndSN Lib "diCrPKI.dll"
(ByVal strCertFile As String, ByVal strOutput As String,
ByVal nOutChars As Long, ByVal nOptions As Long) As Long
nRet = X509_HashIssuerAndSN(strCertFile, strOutput, nOutChars, nOptions)
String with the filename of the X.509 certificate
(or base64 representation).String to receive the hash digest.Long specifying the maximum number of characters to be received.Long Option flags. Select one of:
long _stdcall X509_HashIssuerAndSN(const char *szCertFile, char *szOutput, long nOutChars, long flags);
Long: Returns the number of characters set in strOutput.
If nOutChars is zero it returns the maximum number of characters required.
C/C++ users should allocate one extra for the terminating NUL character.
If an error occurs, it returns a negative error code.
The certificate may be in binary BER format or base64 PEM format.
Dim nRet As Long
Dim strCertName As String
Dim strOutput As String * PKI_MAX_HASH_CHARS
strCertName = "C:\Test\BobRSASignByCarl.cer" ' Set dir to suit
nRet = X509_HashIssuerAndSN(strCertName, strOutput, Len(strOutput), 0)
Debug.Print "X509_HashIssuerAndSN returns " & nRet & " for " & strCertName & ": " & Left(strOutput, nRet)
Should result in
X509_HashIssuerAndSN returns 40 for C:\Test\BobRSASignByCarl.cer: 483538bca32adeb3134fe9f74d1ae74cc9ed2e9e
X509_CertIsValidNow X509_CertThumb