FetchOCSPResponse
Digital signatures
Requires the Enterprise edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibEnterprise (unit PDFlibEnterprise); the Enterprise DLL and ActiveX builds provide it unchanged; other editions keep the method, which returns an empty string and sets LastErrorCode to 900 (PDFLIB_ERROR_ENTERPRISE_REQUIRED)
Description
Asks an OCSP responder for the status of a certificate and returns the reply
Syntax
Delphi
Function TPDFlib.FetchOCSPResponse(Const SubjectCertDER, IssuerCertDER: AnsiString; Const ResponderURL: WideString): AnsiString; Virtual;DLL
const char* DLFetchOCSPResponse(int InstanceID, const char* SubjectCertDER, int SubjectCertDERLength, const char* IssuerCertDER, int IssuerCertDERLength, const wchar_t* ResponderURL, int* ByteCount);
const char* DLFetchOCSPResponseA(int InstanceID, const char* SubjectCertDER, int SubjectCertDERLength, const char* IssuerCertDER, int IssuerCertDERLength, const char* ResponderURL, int* ByteCount);ActiveX
Function PDFlib::FetchOCSPResponse(SubjectCertDER As Variant, IssuerCertDER As Variant, ResponderURL As String) As VariantParameters
| SubjectCertDER | The certificate whose status is being asked about, DER encoded |
|---|---|
| IssuerCertDER | The certificate that issued it, DER encoded |
| ResponderURL | The responder address, or an empty string to use the one the subject certificate names in its Authority Information Access extension |
Return values
| Response | The OCSPResponse bytes, ready for the document security store |
|---|---|
| Empty string | The exchange failed or the responder did not answer successful; GetTimeStampError carries the reason |
Remarks
Only a successful response is returned. A responder that answered tryLater or unauthorized sent an error report, not a status answer, and storing it would leave a validator parsing the wrong structure
The timeout is the one set by SetTimeStampOptions
Example
Response:= PDF.FetchOCSPResponse(SignerCert, IssuerCert, '');
if Response= '' then
ShowMessage(PDF.GetTimeStampError);