[]
        
(Showing Draft Content)

getOcspUrl

Function: getOcspUrl()

function getOcspUrl(certificatePem): string;

Extracts the OCSP responder URL from the given X.509 certificate.

The function parses the Authority Information Access (AIA) extension of the certificate and returns the URI associated with the OCSP access method, if present.

Parameters

certificatePem

string

The certificate in PEM format.

Returns

string

The OCSP responder URL, or null if the certificate does not contain an OCSP entry in its AIA extension.

Remarks

Some certificates may include multiple OCSP URLs; in such cases, the first one is returned. If the AIA extension is missing or does not contain an OCSP access method, the function returns null.