CryptoSys PKI examples VB6 to VB.NET

OCSP_ReadResponse

Reads a response to an Online Certification Status Protocol (OCSP) request and outputs the main results in text form.

VB6/VBA

Debug.Print "Testing OCSP_ReadResponse ..."
Dim nChars As Long
Dim strResponseFile As String
Dim strIssuerFile As String
Dim strBuf As String
strResponseFile = "ocsp_response_ok_dims.dat"
strIssuerFile = "UTNUSERFirst-Object.cer"
Debug.Print "ResponseFile=" & strResponseFile
Debug.Print "IssuerFile=" & strIssuerFile
nChars = OCSP_ReadResponse("", 0, strResponseFile, strIssuerFile, "", 0)
Debug.Print "OCSP_ReadResponse returns " & nChars & " (expected +ve)"
If (nChars <= 0) Then Exit Sub   ' ERROR
strBuf = String(nChars, " ")
nChars = OCSP_ReadResponse(strBuf, nChars, strResponseFile, strIssuerFile, "", 0)
Debug.Print "OCSPResponse=" & strBuf

Output

Testing OCSP_ReadResponse ...
ResponseFile=ocsp_response_ok_dims.dat
IssuerFile=UTNUSERFirst-Object.cer
OCSP_ReadResponse returns 120 (expected +ve)
OCSPResponse=Successful response:
 Produced at 2010-03-18T00:09:28Z
 CertStatus=good
 SerialNumber=00FBC723228C8C8022D8859223DEE70660

VB.NET

Console.WriteLine("Testing OCSP_ReadResponse ...")
''Dim nChars As Integer
Dim strResponseFile As String
Dim strIssuerFile As String
Dim strBuf As String
strResponseFile = "ocsp_response_ok_dims.dat"
strIssuerFile = "UTNUSERFirst-Object.cer"
Console.WriteLine("ResponseFile=" & strResponseFile)
Console.WriteLine("IssuerFile=" & strIssuerFile)
strBuf = Ocsp.ReadResponse(strResponseFile, strIssuerFile)
Console.WriteLine("OCSP_ReadResponse returns " & strBuf.Length & " (expected +ve)")
Console.WriteLine("OCSPResponse=" & strBuf)

[Contents]

[HOME]   [NEXT: PEM_FileFromBinFile...]

Copyright © 2010-20 D.I. Management Services Pty Ltd. All rights reserved.