setasign\SetaPDF2\Signer\Ocsp

Response Class representing an OCSPResponse structure.

File: /SetaPDF v2/Signer/Ocsp/Response.php
Old class name (alias): \SetaPDF_Signer_Ocsp_Response

OCSPResponse ::= SEQUENCE {
    responseStatus         OCSPResponseStatus,
    responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL
}

OCSPResponseStatus ::= ENUMERATED {
    successful            (0),  --Response has valid confirmations
    malformedRequest      (1),  --Illegal confirmation request
    internalError         (2),  --Internal error in issuer
    tryLater              (3),  --Try again later
                                --(4) is not used
    sigRequired           (5),  --Must sign the request
    unauthorized          (6)   --Request unauthorized
}

Class hierarchy

Summary

Constants

STATUS_INTERNAL_ERROR

public const int Response::STATUS_INTERNAL_ERROR = 2

Status constant.

STATUS_MALFORMED_REQUEST

public const int Response::STATUS_MALFORMED_REQUEST = 1

Status constant.

STATUS_SIG_REQUIRED

public const int Response::STATUS_SIG_REQUIRED = 5

Status constant.

STATUS_SUCCESSFUL

public const int Response::STATUS_SUCCESSFUL = 0

Status constant.

STATUS_TRY_LATER

public const int Response::STATUS_TRY_LATER = 3

Status constant.

STATUS_UNAUTHORIZED

public const int Response::STATUS_UNAUTHORIZED = 6

Status constant.


Static Properties

$usePhpseclibForRsaPss

Flag defining whether usage of phpseclib or default OpenSSL methods for RSA_PSS validation.

$verifyCallback

A callable that can be used to implement individual verification logic.


Properties

$_basicResponse

The basic response element if available.

$_response

The response message.

$_singleResponses

An array of the single responses.


Methods

__construct()

public Response::__construct (
string $response
)

The constructor.

Parameters
$response : string
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \InvalidArgumentException

_getBasicResponse()

_getExtension()

protected Response::_getExtension (
string $extensionOid
): bool|\SetaPDF_Signer_Asn1_Element

Get an extension from the response by its OID.

Parameters
$extensionOid : string
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

_getResponseData()

get()

public Response::get (
void
): string

Get the response as an ASN.1 string.

getAsn1()

Get the ASN.1 instance of the OCSP response.

getCertificates()

Get all certificates embedded in the response.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

getNonce()

public Response::getNonce (
void
): bool|string

Get the nonce value from the response.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

getProducedAt()

public Response::getProducedAt (
void
): ?\DateTime

Get the producedAt information.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

getResponderId()

public Response::getResponderId (
void
): ?string

Get the responder id from the responder data.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

getSignatureAlgorithm()

getSignatureValue()

public Response::getSignatureValue (
bool $hex = true
): ?string
Parameters
$hex : bool
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

getSignedData()

public Response::getSignedData (
void
): bool|string
Exceptions

Throws \setasign\SetaPDF2\Signer\Exception

getSingleResponses()

Get the single responses from the response.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

getStatus()

public Response::getStatus (
void
): int

Get the status of the response.

Return Values

See self::STATUS_* constants.

Exceptions

Throws \setasign\SetaPDF2\Signer\Exception

isGood()

public Response::isGood (
void
): bool

Checks if this response object is "good".

Evaluates to true if the status of the whole response is self::STATUS_SUCCESSFUL and the certificate status of all single responses are SingleResponse::CERT_STATUS_GOOD.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

verify()

Verify the signed object.

Parameters
$signerCertificate : \SetaPDF_Signer_X509_Certificate
 
Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception

withoutCertificates()

This method returns a new instance with the certs field removed in the BasicOCSPResponse.

Exceptions

Throws \setasign\SetaPDF2\Signer\Asn1\Exception

Throws \setasign\SetaPDF2\Signer\Exception