OPENSSL-OCSP(1ossl)
π NAME
openssl-ocsp β the Online Certificate Status Protocol command, aka your go-to bestie for checking whether a cert is still slaying or has been revoked π
Manual page for OPENSSL-OCSP(1ossl), in case you were wondering which one of the OpenSSL gals this is π«Ά
β¨ SYNOPSIS
π§ 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
Okay so β the Online Certificate Status Protocol (OCSP) is how applications figure out the (revocation) state of a specific, identified certificate. That's per RFC 2560, no cap π
This command does a whole bunch of common OCSP tasks, like literally it's the main character of OCSP tooling π It can print out requests and responses, create requests, send queries off to an OCSP responder, and even behave like a mini OCSP server all by itself. Versatile queen behavior fr fr π
π OPTIONS
Heads up bestie: this command runs as either a client or a server, so the options are split into those two modes. Both lists are right below β¬οΈ
π OCSP Client Options
-helpβ Prints out a usage message. Classic, iconic, always there for you π«Ά-out filenameβ Specifies the output filename. If you don't say anything, the default is standard output β¨-issuer filenameβ This one specifies the current issuer certificate. Input can be in PEM, DER, or PKCS#12 format.
You can use this option multiple times! But careful: this option MUST come before any -cert options. Order matters, bestie π¨
-cert filenameβ Adds the certificate filename to the request. Input can be in PEM, DER, or PKCS#12 format.
Also repeatable π« The issuer certificate gets taken from the previous -issuer option β and if no issuer certificate is specified, an error occurs. So don't leave her hanging π
-no_certsβ Don't include any certificates in the signed request. Simple as that π-serial numβ Same as the-certoption, except instead of a file you add the certificate with serial number num to the request. The serial number is interpreted as a decimal integer unless it's preceded by"0x". Negative integers can also be specified by putting a"-"sign in front of the value π’-signer filename,-signkey filenameβ Signs the OCSP request using the certificate specified in the-signeroption and the private key specified by the-signkeyoption. Input can be in PEM, DER, or PKCS#12 format.
If the -signkey option is not present, then the private key is read from the same file as the certificate. If neither option is specified, then the OCSP request is just not signed. No pressure π
-sign_other filenameβ Additional certificates to include in the signed request. Input can be in PEM, DER, or PKCS#12 format. The more the merrier π-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-reqinoption, no nonce is added β but using the-nonceoption will force addition of a nonce. And if an OCSP request is being created (using the-certand-serialoptions), a nonce is automatically added, and specifying-no_nonceoverrides that. Pick your fighter βοΈ-req_text,-resp_text,-textβ Print out the text form of the OCSP request, response, or both respectively. Reading rainbow era π-reqout file,-respout filenameβ Write out the DER-encoded OCSP request or response to filename. Fun fact: the output filename can be the same as the input filename, which leads to replacing the file contents. Note that file I/O is not atomic β the output file gets truncated and then written. Consider yourself warned π-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,-certand-hostoptions). She only speaks up when it's her moment β-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 the details, see the-hostand-pathoptions described right next π-host host:port,-path pathnameβ If the-hostoption 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, such as127.0.0.1or"[::1]"for localhost. If it's an IPv6 address, it must be enclosed in"["and"]"β brackets are not optional, bestie π§
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. Same energy, different font π
-proxy [http[s]://][userinfo@]host[:port][/path][?query][#fragment]β The HTTP(S) proxy server to use for reaching the OCSP server, unless-no_proxyapplies (see below). If the host string is an IPv6 address, it must be enclosed in"["and"]". The proxy port defaults to80, or443if the scheme is"https"β apart from that, the optional"http://"or"https://"prefix is ignored, as well as any userinfo, path, query, and fragment components. 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". Environment variable chain, slay π-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 (where in the latter case the whole argument must be enclosed in"..."). Default is from the environment variable"no_proxy"if set, else"NO_PROXY". This is the "do not perceive her" list π-header name=valueβ Adds the header name with the specified value to the OCSP request that is sent to the responder. This may be repeated β stack those headers, queen π-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. This time is measured from the moment the responder accepts the connection until the complete request is received. Punctuality is hot π₯-verify_other fileβ File or URI containing additional certificates to search when attempting to locate the OCSP response signing certificate. Some responders are shady and omit the actual signer's certificate from the response β this option lets you supply the necessary certificate in such cases. Input can be in PEM, DER, or PKCS#12 format. Backup plan, iconic π«Ά-trust_otherβ The certificates specified by the-verify_otheroption should be explicitly trusted and no additional checks will be performed on them. Useful when the complete responder certificate chain isn't available, or when trusting a root CA is just not appropriate. Trust her, she knows what she's doing π-VAfile fileβ File or URI containing explicitly trusted responder certificates. Equivalent to the-verify_otherand-trust_otheroptions together. Input can be in PEM, DER, or PKCS#12 format. Two-for-one deal β¨-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. Live dangerously, but like, only for debugging π-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_otheror-VAfileoptions. No freeloaders allowed π«-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. Testing only, bestie β I'm serious π-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. Any certificate. Yeah. Testing. Only. π-no_chainβ Do not use certificates in the response as additional untrusted CA certificates. Cutting the chain, bold move βοΈ-no_explicitβ Do not explicitly trust the root CA if it is set to be trusted for OCSP signing. Respectfully declining π-no_cert_checksβ Don't perform any additional checks on the OCSP response signer's certificate. That is, do not make any checks to see if the signer's certificate is authorised to provide the necessary status information β as a result this option should only be used for testing purposes. No vibe checks, no auth checks, no anything. Testing. Purposes. π-validity_period nsec,-status_age ageβ These options specify the range of times, in seconds, which 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 and clients' clocks may not be precisely synchronised, and so such a check may fail. To avoid this, the-validity_periodoption can be used to specify an acceptable error range in seconds β the default value is 5 minutes π
If the notAfter time is omitted from a response, then this means that new status information is immediately available. In this case the age of the notBefore field is checked to see it is not older than age seconds old. By default, this additional check is not performed. Opt-in only π«
-rcid digestβ This option sets the digest algorithm to use for certificate identification in the OCSP response. Any digest supported by theopenssl-dgst(1)command can be used. The default is the same digest algorithm used in the request. Consistent queen behavior π-digestβ sets the digest algorithm used for certificate identification in the OCSP request. Any digest that the OpenSSLdgstcommand supports is fair game, bestie. The default isSHA-1. You can use this option multiple times to specify the digest used by subsequent certificate identifiers β¨-CAfilefile,-no-CAfile,-CApathdir,-no-CApath,-CAstoreuri,-no-CAstoreβ okay so these are the whole trusted-certificate situation, and the details live in "Trusted Certificate Options" inopenssl-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β bestie this is the whole certificate chain verification menu, one giant vibe check for certs. The details are in "Verification Options" inopenssl-verification-options(1)π-providernamebr/>-provider-pathpathbr/>-provparam[name:]key=valuebr/>-propquerypropq β the provider crowd. See "Provider Options" inopenssl(1),provider(7), andproperty(7)π
π₯οΈ OCSP Server Options π₯οΈ
-indexindexfile β so indexfile is the name of a text index file, incaformat, that holds the certificate revocation info.
The tea here: if you pass -index, this command switches into responder mode. If you don't, it stays in client mode. And the request(s) the responder handles can come from three places: straight off the command line (with the -issuer and -serial options), from a file (with the -reqin option), or from external OCSP clients (if -port or -url is specified) πΈ
And if-indexis present, then-CAand-rsignermust also be present. No exceptions, periodt.
-CAfile β the CA certificates that correspond to the revocation info in the index file you gave with-index. The input can be in PEM, DER, or PKCS#12 format π₯-rsignerfile β the certificate used to sign OCSP responses. Input can be PEM, DER, or PKCS#12 format π-rkeyfile β the private key used to sign OCSP responses. If it's not present, the file specified in the-rsigneroption gets used instead π¦-passinarg β the private key password source. For the whole format of arg situation, seeopenssl-passphrase-options(1)β¨-rotherfile β extra certificates to include in the OCSP response. Input can be PEM, DER, or PKCS#12 format π«-rsigoptnm:v β passes options to the signature algorithm when signing OCSP responses. The names and values of these options are algorithm-specific, so like, check the algorithm's own lore π-rmddigest β the digest to use when signing the response π-badsigβ literally corrupts the response signature before writing it out. Useful for testing, bestie. It's giving "bug on purpose" π-resp_no_certsβ don't include any certificates in the OCSP response π-resp_key_idβ identifies the signer certificate using the key ID. The default is to use the subject name β-portportnum β the port to listen for OCSP requests on. Both IPv4 and IPv6 are possible, icon behavior. The port can also be specified with the-urloption. And a0argument means any available port shall be chosen automatically π-ignore_errβ ignores malformed requests or responses. When acting as an OCSP client: retry if a malformed response is received. When acting as an OCSP responder: keep running instead of terminating when a malformed request shows up. Resilient queen π-nrequestnumber β the OCSP server will exit after receiving number requests. Default is unlimited π§-multiprocess-count β runs the specified number of OCSP responder child processes, and the parent process respawns child processes as needed. Child processes will detect changes in the CA index file and automatically reload it. When running as a responder, the-timeoutoption is recommended to limit the time each child is willing to wait for the client's OCSP response. Heads up: this option is available on POSIX systems (the ones that supportfork()and other required unix system-calls) π-nminminutes,-ndaysdays β the number of minutes or days when fresh revocation information is available. This goes in thenextUpdatefield. If neither option is present, then thenextUpdatefield is omitted, which means fresh revocation information is immediately available β°
π OCSP RESPONSE VERIFICATION π
OCSP Response follows the rules specified in RFC2560. No cap π«Ά
First up: the OCSP responder certificate is located, and the signature on the OCSP request gets 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. You can specify where the trusted certificates used to build that chain live with the -CAfile, -CApath or -CAstore options β or they'll be looked for in the standard OpenSSL certificates directory.
If that initial verify fails, the OCSP verify process halts with an error. Full stop π
Otherwise, the issuing CA certificate in the request is compared to the OCSP responder certificate: if there's 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's 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 responder's CA is checked to see if it's trusted for OCSP signing. If it is, the OCSP verify succeeds πΈ
If none of these checks is successful, then the OCSP verify fails. That's the whole flowchart, bestie π
What this effectively means is that if the OCSP responder certificate is authorised directly by the CA it's issuing revocation information about (and it's correctly configured), then verification will succeed.
If the OCSP responder is a "global responder" that 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 you only need -CApath, -CAfile, -CAstore and (if the responder is a 'global VA') -VAfile. That's it, that's the whole to-do list π
Okay so real talk: 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. And the text index file format of revocation is inefficient for large quantities of revocation data. Not the main character of OCSP responders, ngl π
It is possible to run this command in responder mode via a CGI script using the -reqin and -respout options though π¦
π 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 a 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. Throwback β¨
Β©οΈ COPYRIGHT Β©οΈ
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>.
And that's the whole page, bestie β this is OpenSSL 3.5.9, dated 2026-09-29, aka the OPENSSL-OCSP(1ossl) era. Go forth and verify those responses, you absolute icon πππ¦
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms