JA
header image

枝折 - bookmark

Certificate Revocation Checking with OCSP

PKI

CREATED: 2024 / 03 / 03 Sun

UPDATED: 2024 / 03 / 03 Sun

Certificate Revocation Checking with OCSP

Certificate Revocation Checking

Certificate revocation can be checked using a CRL (Certificate Revocation List). Clients download the CRL each time to verify a certificate hasn’t been revoked. However, as the internet has grown, this approach has become increasingly burdensome, so OCSP (Online Certificate Status Protocol) is now commonly used instead.

References:

How to Send a Request to an OCSP Responder

Requests to an OCSP responder are generally made automatically, but here’s how to do it manually. You can request a revocation check with the following openssl command:

$ openssl ocsp -no_nonce -issuer issuer.cer -cert subject.cer -url ${OCSP URL} -text

Set issuer.cer to the intermediate CA or root CA certificate that issued the certificate being verified, and subject.cer to the certificate being verified. Include the OCSP responder URL from the server certificate in the URL field. You can retrieve the URL with the following command:

# Using a Google Chrome certificate
$ openssl x509 -noout -ocsp_uri -in subject.cer
http://ocsp.pki.goog/gts1c3

Running a revocation check request with this produces the following output. The intermediate certificate was downloaded from Google’s PKI repository for verification:

openssl ocsp -no_nonce -issuer gts1c3.pem -cert subject.cer -url http://ocsp.pki.goog/gts1c3 -text
OCSP Request Data:
    Version: 1 (0x0)
    Requestor List:
        Certificate ID:
          Hash Algorithm: sha1
          Issuer Name Hash: C72E798ADDFF6134B3BAED4742B8BBC6C0240763
          Issuer Key Hash: 8A747FAF85CDEE95CD3D9CD0E24614F371351D27
          Serial Number: C389D85E94B24B6909EC2AA96C658A5A
OCSP Response Data:
    OCSP Response Status: successful (0x0)
    Response Type: Basic OCSP Response
    Version: 1 (0x0)
    Responder Id: 8A747FAF85CDEE95CD3D9CD0E24614F371351D27
    Produced At: Mar  2 11:23:49 2024 GMT
    Responses:
    Certificate ID:
      Hash Algorithm: sha1
      Issuer Name Hash: C72E798ADDFF6134B3BAED4742B8BBC6C0240763
      Issuer Key Hash: 8A747FAF85CDEE95CD3D9CD0E24614F371351D27
      Serial Number: C389D85E94B24B6909EC2AA96C658A5A
    Cert Status: good
    This Update: Mar  2 11:23:49 2024 GMT
    Next Update: Mar  9 10:23:48 2024 GMT

    Signature Algorithm: sha256WithRSAEncryption
         87:52:70:1b:6f:12:ed:7d:01:9e:16:47:5b:99:c2:68:2d:f5:
         25:0e:3f:a2:f6:a5:c4:8d:82:4b:07:5a:59:9b:03:f5:78:72:
         b2:54:bf:2f:4f:58:26:be:e7:2a:30:bf:47:7c:76:c9:f7:14:
         db:2a:f5:6d:a8:a4:30:21:49:59:c5:cc:2f:52:56:de:ee:01:
         40:07:cb:2f:e6:1b:af:8b:da:73:e1:c9:51:97:b3:33:2f:18:
         30:69:6d:aa:99:e2:b9:a4:56:c6:f5:f1:14:7e:ee:e2:10:b2:
         e6:77:da:0d:18:d7:0b:58:1c:79:9a:53:83:af:44:80:b7:f4:
         98:dc:82:9c:ff:72:66:3a:83:f6:bd:70:86:65:ca:12:27:6d:
         ce:b7:b0:94:f0:13:b4:ea:7d:98:48:0a:1c:4b:ce:07:ca:44:
         28:d6:34:9c:15:4d:fe:17:12:03:4d:d2:7b:82:3e:52:d7:8a:
         c8:a7:19:d6:51:45:15:cd:53:39:bd:72:7b:f0:4f:72:9c:6c:
         5c:fb:c2:8c:6e:1f:9d:67:fa:44:7e:f8:85:14:c3:a2:8f:b4:
         6f:e3:5a:07:73:fe:10:bd:e6:7d:76:b9:91:87:6a:ea:ac:a0:
         ab:e6:3d:d3:24:b8:3e:27:49:f2:2a:7c:06:d4:26:e4:7c:e3:
         8e:25:03:33
Response Verify Failure
8036700160:error:27FFF076:OCSP routines:CRYPTO_internal:signer certificate not found:/AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/ocsp/ocsp_vfy.c:89:
subject.cer: good
	This Update: Mar  2 11:23:49 2024 GMT
	Next Update: Mar  9 10:23:48 2024 GMT

Appendix