FetchOCSPResponse

Digital signatures

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;

Parameters

SubjectCertDERThe certificate whose status is being asked about, DER encoded.
IssuerCertDERThe certificate that issued it, DER encoded.
ResponderURLThe responder address, or an empty string to use the one the subject certificate names in its Authority Information Access extension.

Return values

ResponseThe OCSPResponse bytes, ready for the document security store.
Empty stringThe 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);

See also

BuildOCSPRequest, AddPAdESDSSOCSPFromCertificates