Dumps details of an X.509 certificate or a X.509 certificate revocation list (CRL) or a PKCS-10 certificate signing request (CSR) to a string.
Public Declare Function X509_TextDumpToString Lib "diCrPKI.dll" (ByVal strOutput As String, ByVal nOutChars As Long, ByVal strCertFile As String, ByVal nOptions As Long) As Long
nRet = X509_TextDumpToString(strOutput, nOutChars, strCertFile, nOptions)
long __stdcall X509_TextDumpToString(char *szOutput, long nOutChars, const char *szCertFile, long nOptions);
If successful, the return value is the number of characters in or required for the output string; otherwise it returns a negative error code.
Public Function x509TextDumpToString
(szCertFile As String, Optional nOptions As Long = 0) As String
static std::string dipki::X509::TextDumpToString (const std::string &certFile, OutputOpts outOpts=OutputOpts::Default_OutputOpt)
static X509.text_dump_tostring(certfile, opts=0)
For the "raw" VBA/C function, the user must allocate an output string buffer szOutput of the required length. Specify a zero nOutChars or an empty string for szOutput to find the required length. ANSI C users must add one to this value when allocating memory.
The input file may be a an X.509 certificate, X.509 certificate revocation list (CRL) or PKCS-10 certificate signing request (CSR) and may be a file in binary BER/DER or base64 PEM file format, or may be passed in base64 representation or as a PEM string.
The output string must be long enough to receive the complete output or a SHORT_BUF_ERROR error will result.
Dim strInputFile As String Dim strBuffer As String Dim nChars As Long strInputFile = "AliceRSASignByCarl.cer" Debug.Print "File=" & strInputFile ' Query for required length nChars = X509_TextDumpToString("", 0, strInputFile, PKI_X509_DECIMAL) Debug.Print "X509_TextDumpToString returns " & nChars ' Dimension output buffer strBuffer = String(nChars, " ") nChars = X509_TextDumpToString(strBuffer, Len(strBuffer), strInputFile, PKI_X509_DECIMAL) Debug.Print strBuffer
File=AliceRSASignByCarl.cer X509_TextDumpToString returns 1692 X.509 CERTIFICATE Version: 3 Serial Number: 93318145165434344057210696409401045936 Issuer: CN=CarlRSA ...[cut]...
Debug.Print x509TextDumpToString("AliceRSASignByCarl.cer")
Debug.Print x509QueryCert("AliceRSASignByCarl.cer", "subjectName")
Debug.Print asn1TextDumpToString("AliceRSASignByCarl.cer")