OPENSSL-OCSP(1SSL)

πŸ’– OPENSSL-OCSP πŸ’–

okay bestie, welcome to openssl-ocsp, aka the Online Certificate Status Protocol command from the OpenSSL fam β€” this is the page for OPENSSL-OCSP(1SSL) and it's a whole mood. sit down, grab a strawberry, we're doing this ✨


🌸 NAME 🌸

openssl-ocsp β€” the Online Certificate Status Protocol command, no cap 🫢


✨ SYNOPSIS ✨

so there's two whole modes here, and they're giving very different energy. first up:

πŸŽ€ OCSP Client

openssl ocsp [-help] [-out file] [-issuer file] [-cert file] [-no_certs]
[-serial n] [-signer file] [-signkey file] [-sign_other file] [-nonce]
[-no_nonce] [-req_text] [-resp_text] [-text] [-reqout filename]
[-respout filename] [-reqin filename] [-respin filename] [-url URL]
[-host host:port] [-path pathname] [-proxy
[http[s]://][userinfo@]host[:port][/path][?query][#fragment]] [-no_proxy
addresses] [-header] [-timeout seconds] [-VAfile file] [-validity_period
n] [-status_age n] [-noverify] [-verify_other file] [-trust_other]
[-no_intern] [-no_signature_verify] [-no_cert_verify] [-no_chain]
[-no_cert_checks] [-no_explicit] [-port num] [-ignore_err]

πŸ‘‘ OCSP Server

openssl ocsp [-index file] [-CA file] [-rsigner file] [-rkey file]
[-passin arg] [-rother file] [-rsigopt nm:v] [-rmd digest] [-badsig]
[-resp_no_certs] [-nmin n] [-ndays n] [-resp_key_id] [-nrequest n]
[-multi process-count] [-rcid digest] [-digest] [-CAfile file]
[-no-CAfile] [-CApath dir] [-no-CApath] [-CAstore uri] [-no-CAstore]
[-allow_proxy_certs] [-attime timestamp] [-no_check_time]
[-check_ss_sig] [-crl_check] [-crl_check_all] [-explicit_policy]
[-extended_crl] [-ignore_critical] [-inhibit_any] [-inhibit_map]
[-partial_chain] [-policy arg] [-policy_check] [-policy_print] [-purpose
purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192] [-trusted_first]
[-no_alt_chains] [-use_deltas] [-auth_level num] [-verify_depth num]
[-verify_email email] [-verify_hostname hostname] [-verify_ip ip]
[-verify_name name] [-x509_strict] [-issuer_checks] [-provider name]
[-provider-path path] [-provparam [name:]key=value] [-propquery propq]

πŸ¦‹ DESCRIPTION πŸ¦‹

The Online Certificate Status Protocol (OCSP) lets applications figure out the (revocation) state of an identified certificate β€” that's RFC 2560, periodt πŸ’…

This command does a bunch of the common OCSP tasks for you. It can print out requests and responses, create requests and send queries to an OCSP responder, and yes, it can lowkey act like a mini OCSP server all on its own. main character behavior fr fr πŸ‘‘


πŸ’… OPTIONS πŸ’…

This command operates as either a client or a server, so the options split into two modes, bestie. Both are described below.


🫢 OCSP Client Options

  • -help β€” prints out a usage message. cute, quick, done.
  • -out filename β€” specifies the output filename. the default is standard output.
  • -issuer filename β€” this specifies the current issuer certificate. the input can be in PEM, DER, or PKCS#12 format.

This option can be used multiple times. and listen β€” this option MUST come before any -cert options. no negotiating on that one bestie, order matters 😀

  • -cert filename β€” adds the certificate filename to the request. the input can be in PEM, DER, or PKCS#12 format.

This option can be used multiple times. the issuer certificate gets pulled from the previous -issuer option β€” and if there's no issuer certificate specified at all, you get an error. awkward πŸ™ˆ

  • -no_certs β€” don't include any certificates in a signed request.
  • -serial num β€” same as the -cert option, except the certificate with serial number num is what gets added to the request. the serial number is read as a decimal integer unless it's preceded by "0x". negative integers can also be specified by preceding the value with a - sign.
  • -signer filename, -signkey filename β€” sign the OCSP request using the certificate from -signer and the private key from -signkey. the input can be in PEM, DER, or PKCS#12 format.

If -signkey isn't there, the private key gets read from the same file as the certificate. And if neither option is specified? then the OCSP request just doesn't get signed. no signature, no problem, that's the vibe ✨

  • -sign_other filename β€” additional certificates to include in the signed request. the input can be in PEM, DER, or PKCS#12 format.
  • -nonce, -no_nonce β€” add an OCSP nonce extension to a request, or disable OCSP nonce addition. normally, if an OCSP request is input using the -reqin option, no nonce is added β€” so using -nonce forces the nonce to be added. but if an OCSP request is being created (with the -cert and -serial options) a nonce is added automatically, and specifying -no_nonce overrides that.
  • -req_text, -resp_text, -text β€” print out the text form of the OCSP request, response, or both, respectively.
  • -reqout file, -respout filename β€” write out the DER-encoded OCSP request or response to filename. the output filename can be the same as the input filename, which leads to replacing the file contents.
heads up: file I/O is not atomic here. the output file is truncated and then written. so don't come crying if something goes sideways mid-write 😭
  • -reqin file, -respin filename β€” read an OCSP request or response file from file. these options are ignored if OCSP request or response creation is implied by other options (for example with the -serial, -cert, and -host options).
  • -url responder_url β€” specify the responder host and optionally port and path via a URL. both HTTP and HTTPS (SSL/TLS) URLs can be specified. the optional userinfo and fragment components are ignored. any given query component is handled as part of the path component. for details, see the -host and -path options described next.
  • -host host:port, -path pathname β€” if -host is present then the OCSP request is sent to the host host on port port. the host may be a domain name or an IP (v4 or v6) address, like 127.0.0.1 or "[::1]" for localhost. if it's an IPv6 address, it must be enclosed in "[" and "]".

The -path option specifies the HTTP pathname to use, or / by default. this is equivalent to specifying -url with scheme http:// and the given host, port, and optional pathname.

  • -proxy [http[s]://][userinfo@]host[:port][/path][?query][#fragment] β€” the HTTP(S) proxy server to use for reaching the OCSP server, unless -no_proxy applies (see below). if the host string is an IPv6 address, it must be enclosed in "[" and "]". the proxy port defaults to 80, or 443 if the scheme is "https"; apart from that, the optional "http://" or "https://" prefix is ignored, along with any userinfo, path, query, and fragment components. it defaults to the environment variable "http_proxy" if set, else "HTTP_PROXY" in case no TLS is used, otherwise "https_proxy" if set, else "HTTPS_PROXY".
  • -no_proxy addresses β€” list of IP addresses and/or DNS names of servers not to use an HTTP(S) proxy for, separated by commas and/or whitespace (and where it's whitespace, the whole argument must be enclosed in "..."). the default comes from the environment variable "no_proxy" if set, else "NO_PROXY".
  • -header name=value β€” adds the header name with the specified value to the OCSP request that's sent to the responder. this may be repeated. stack 'em up 🧚
  • -timeout seconds β€” connection timeout to the OCSP responder, in seconds. on POSIX systems, when running as an OCSP responder, this option also limits the time that the responder is willing to wait for the client request. that time is measured from the moment the responder accepts the connection until the complete request is received.
  • -verify_other file β€” file or URI containing additional certificates to search when attempting to locate the OCSP response signing certificate. some responders omit the actual signer's certificate from the response, and this option lets you supply the necessary certificate in those cases. the input can be in PEM, DER, or PKCS#12 format.
  • -trust_other β€” the certificates specified by -verify_other should be explicitly trusted, and no additional checks will be performed on them. super useful when the complete responder certificate chain isn't available, or when trusting a root CA just isn't appropriate.
  • -VAfile file β€” file or URI containing explicitly trusted responder certificates. equivalent to the -verify_other and -trust_other options together. the input can be in PEM, DER, or PKCS#12 format.
  • -noverify β€” don't attempt to verify the OCSP response signature or the nonce values. this option will normally only be used for debugging, since it disables all verification of the responder's certificate. it's giving chaos mode, honestly πŸ’€
  • -no_intern β€” ignore certificates contained in the OCSP response when searching for the signer's certificate. with this option, the signer's certificate must be specified with either the -verify_other or -VAfile options.
  • -no_signature_verify β€” don't check the signature on the OCSP response. since this option tolerates invalid signatures on OCSP responses, it will normally only be used for testing purposes.
  • -no_cert_verify β€” don't verify the OCSP response signer's certificate at all. since this option allows the OCSP response to be signed by any certificate, it should only be used for testing purposes.
  • -no_chain β€” do not use certificates in the response as additional untrusted CA certificates.
  • -no_explicit β€” do not explicitly trust the root CA if it's set to be trusted for OCSP signing.
  • -no_cert_checks β€” don't perform any additional checks on the OCSP response signer's certificate. that means no checks to see if the signer's certificate is authorised to provide the necessary status information β€” and as a result, this option should only be used for testing purposes.
  • -validity_period nsec, -status_age age β€” these options specify the range of times, in seconds, that will be tolerated in an OCSP response. each certificate status response includes a notBefore time and an optional notAfter time. the current time should fall between these two values, but the interval between the two times may be only a few seconds. in practice the OCSP responder's and the client's clocks may not be precisely synchronised, so such a check may fail. to avoid that, the -validity_period option can specify an acceptable error range in seconds β€” and the default value is 5 minutes ⏰

If the notAfter time is omitted from a response, that means new status information is immediately available. in that case the age of the notBefore field is checked, to see that it's not older than age seconds old. by default this additional check is not performed.

  • -rcid digest β€” this option sets the digest algorithm to use for certificate identification in the OCSP response. any digest supported by the openssl-dgst(1) command can be used. the default is the same digest algorithm used in the request.

and bestie, that's only part 1 of this whole thing β€” there's a lot more ocsp to go, so don't go anywhere πŸ¦‹βœ¨

  • -digest β€” sets the digest algorithm used to identify certs in the OCSP request. Any digest that the OpenSSL dgst command supports is fair game. Default is SHA-1. You can use this option multiple times to set the digest for subsequent cert identifiers. πŸ’…
  • -CAfile file, -no-CAfile, -CApath dir, -no-CApath, -CAstore uri, -no-CAstore β€” bestie, these are the trusted cert options. The full tea is in β€œTrusted Certificate Options” in openssl-verification-options(1). Go read that, iykyk. πŸ“œ
  • -allow_proxy_certs, -attime, -no_check_time, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy, -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map, -no_alt_chains, -partial_chain, -policy, -policy_check, -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192, -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email, -verify_hostname, -verify_ip, -verify_name, -x509_strict, -issuer_checks β€” all of these set various options for certificate chain verification. See β€œVerification Options” in openssl-verification-options(1) for the details. No cap, it's all there. πŸ”
  • -provider name β€” see β€œProvider Options” in openssl(1), provider(7), and property(7). Provider era, periodt. ✨
  • -provider-path path β€” same provider vibes, same references: openssl(1), provider(7), property(7). 🧚
  • -provparam [name:]key=value β€” provider parameter stuff, again see openssl(1), provider(7), and property(7). πŸ“
  • -propquery propq β€” property query, see openssl(1), provider(7), and property(7). πŸ’œ

πŸ”₯ OCSP Server Options πŸ”₯

  • -index indexfile β€” indexfile is the name of a text index file in ca format that contains certificate revocation info. If you pass -index, the command switches into responder mode; otherwise it's in client mode. The request(s) the responder processes can be either on the command line (using -issuer and -serial), supplied in a file (using -reqin), or come in via external OCSP clients (if -port or -url is specified). If -index is present, then -CA and -rsigner must also be present. No skipping, bestie. 🚨
  • -CA file β€” CA certificates that correspond to the revocation info in the index file given with -index. Input can be in PEM, DER, or PKCS#12 format. πŸŽ€
  • -rsigner file β€” the certificate to sign OCSP responses with. Input can be PEM, DER, or PKCS#12. πŸ–ŠοΈ
  • -rkey file β€” the private key to sign OCSP responses with. If this isn't present, the file specified in -rsigner is used. πŸ”‘
  • -passin arg β€” the private key password source. For the format of arg, see openssl-passphrase-options(1). πŸ”
  • -rother file β€” additional certificates to include in the OCSP response. Input can be PEM, DER, or PKCS#12. πŸ“Ž
  • -rsigopt nm:v β€” pass options to the signature algorithm when signing OCSP responses. Names and values are algorithm-specific. πŸ§ͺ
  • -rmd digest β€” the digest to use when signing the response. πŸ’½
  • -badsig β€” corrupt the response signature before writing it. Useful for testing. Not for production, bestie, it's giving chaos. πŸ’€
  • -resp_no_certs β€” don't include any certificates in the OCSP response. πŸ™…β€β™€οΈ
  • -resp_key_id β€” identify the signer certificate using the key ID. Default is to use the subject name. πŸ†”
  • -port portnum β€” port to listen for OCSP requests on. Both IPv4 and IPv6 are possible. The port may also be specified using the -url option. A 0 argument means any available port shall be chosen automatically. 🌐
  • -ignore_err β€” ignore malformed requests or responses. When acting as an OCSP client, retry if a malformed response is received. When acting as an OCSP responder, continue running instead of terminating upon receiving a malformed request. πŸ›‘οΈ
  • -nrequest number β€” the OCSP server will exit after receiving number requests. Default is unlimited. πŸ”’
  • -multi process-count β€” run the specified number of OCSP responder child processes, with the parent process respawning child processes as needed. Child processes will detect changes in the CA index file and automatically reload it. When running as a responder, -timeout is recommended to limit the time each child is willing to wait for the client's OCSP response. This option is available on POSIX systems (that support fork() and other required unix system-calls). 🧬
  • -nmin minutes, -ndays days β€” number of minutes or days when fresh revocation information is available: used in the nextUpdate field. If neither option is present, then the nextUpdate field is omitted, meaning fresh revocation information is immediately available. ⏳

πŸ’– OCSP RESPONSE VERIFICATION πŸ’–

OCSP Response follows the rules specified in RFC2560. Periodt. πŸ“œ

Initially the OCSP responder certificate is located and the signature on the OCSP request checked using the responder certificate's public key. πŸ”‘

Then a normal certificate verify is performed on the OCSP responder certificate, building up a certificate chain in the process. The locations of the trusted certificates used to build the chain can be specified by the -CAfile, -CApath or -CAstore options, or they will be looked for in the standard OpenSSL certificates directory. πŸ“‚

If the initial verify fails, then the OCSP verify process halts with an error. πŸ›‘

Otherwise the issuing CA certificate in the request is compared to the OCSP responder certificate: if there is a match, then the OCSP verify succeeds. βœ…

Otherwise the OCSP responder certificate's CA is checked against the issuing CA certificate in the request. If there is a match and the OCSPSigning extended key usage is present in the OCSP responder certificate, then the OCSP verify succeeds. 🎯

Otherwise, if -no_explicit is not set, the root CA of the OCSP responders CA is checked to see if it is trusted for OCSP signing. If it is, the OCSP verify succeeds. 🌈

If none of these checks is successful, then the OCSP verify fails. ❌

What this effectively means is that if the OCSP responder certificate is authorised directly by the CA it is issuing revocation information about (and it is correctly configured), then verification will succeed. 🀝

If the OCSP responder is a "global responder" which can give details about multiple CAs and has its own separate certificate chain, then its root CA can be trusted for OCSP signing. For example:

openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem

Alternatively the responder certificate itself can be explicitly trusted with the -VAfile option. πŸ’…

πŸ“ NOTES πŸ“

As noted, most of the verify options are for testing or debugging purposes. Normally only the -CApath, -CAfile, -CAstore and (if the responder is a 'global VA') -VAfile options need to be used. πŸ‘€

Lowkey, the OCSP server is only useful for test and demonstration purposes: it is not really usable as a full OCSP responder. It contains only a very simple HTTP request handling and can only handle the POST form of OCSP queries. It also handles requests serially, meaning it cannot respond to new requests until it has processed the current one. The text index file format of revocation is also inefficient for large quantities of revocation data. Highkey a struggle. 😬

It is possible to run this command in responder mode via a CGI script using the -reqin and -respout options. 🐚

🌸 EXAMPLES 🌸

Create an OCSP request and write it to a file:

openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der

Send a query to an OCSP responder with URL http://ocsp.myhost.com/, save the response to a file, print it out in text form, and verify the response:

openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \
    -url http://ocsp.myhost.com/ -resp_text -respout resp.der

Read in an OCSP response and print out text form:

openssl ocsp -respin resp.der -text -noverify

OCSP server on port 8888 using a standard ca configuration, and a separate responder certificate. All requests and responses are printed to a file.

openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
        -text -out log.txt

As above but exit after processing one request:

openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
    -nrequest 1

Query status information using an internally generated request:

openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
    -issuer demoCA/cacert.pem -serial 1

Query status information using request read from a file, and write the response to a second file.

openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
    -reqin req.der -respout resp.der

πŸ•°οΈ HISTORY πŸ•°οΈ

The -no_alt_chains option was added in OpenSSL 1.1.0. πŸ‘‘

Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved. πŸ’–

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>. πŸ“„


okay bestie, that's the whole vibe. This page was source/version 4.0.3, dated 2026-09-29, from OPENSSL-OCSP(1SSL). Slay, you made it to the end! πŸŽ€βœ¨

πŸ“¦ where this page comes from