X509_CertSerialNumber
returns the serial number of an X.509 certificate in hexadecimal format.
Public Declare Function X509_CertSerialNumber Lib "diCrPKI.dll"
(ByVal strCertFile As String, ByVal strOutput As String,
ByVal nOutChars As Long, ByVal nOptions As Long) As Long
nRet = X509_CertSerialNumber(strCertFile, strOutput, nOutChars, nOptions)
String with the filename of the X.509 certificate
(or base64 representation).String to receive the serial number.Long specifying the maximum number of characters to be received.Long option flags: not used in this release. Specify zero.
long _stdcall X509_CertSerialNumber(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 DER format or base64 PEM format.
Dim nRet As Long Dim strCertName As String Dim strOutput As String * 64 strCertName = "C:\Test\BobRSASignByCarl.cer" ' Set dir to suit nRet = X509_CertSerialNumber(strCertName, strOutput, Len(strOutput), 0) Debug.Print "X509_CertSerialNumber returns " & nRet & " for " & strCertName & ": " & strOutput
Should result in
X509_CertSerialNumber returns 32 for C:\Test\BobRSASignByCarl.cer: 46346bc7800056bc11d36e2ecd5d71d0
X509_CertIsValidNow X509_CertThumb