OPENSSL-OCSP(1ossl)
OPENSSL-OCSP(1ossl) π¦
openssl-ocsp β the Online Certificate Status Protocol command, but make it bestie-friendly π
β¨ NAME β¨
openssl-ocsp β Online Certificate Status Protocol command π
π 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 πΈ
The Online Certificate Status Protocol (OCSP) lets applications figure out the (revocation) state of an identified certificate β thatβs RFC 2560, bestie πβ¨
This command does a whole bunch of common OCSP tasks. It can print out requests and responses, create requests and send queries to an OCSP responder, and even behave like a mini OCSP server itself. Itβs giving main character energy in both directions ππ
π OPTIONS π
This command operates as either a client or a server. The options are described below, divided into those two modes. Two modes, one icon π
π«Ά OCSP Client Options π«Ά
-helpβ Print out a usage message. Tiny helpful angel behavior πΌ-out filenameβ Specify output filename; 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. This option MUST come before any -cert options. Like, fr fr, order matters π¨
-cert filenameβ Add 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 is taken from the previous -issuer option, or an error occurs if no issuer certificate is specified. No issuer? Itβs giving error, bestie π
-no_certsβ Donβt include any certificates in signed request.-serial numβ Same as the-certoption except the certificate with serial numbernumis added to the request. The serial number is interpreted as a decimal integer unless preceded by"0x". Negative integers can also be specified by preceding the value by a"-"sign.-signer filename,-signkey filenameβ Sign the OCSP request using the certificate specified in the-signeroption and the private key specified by the-signkeyoption. The 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 not signed. No keys, no signature, no drama π
-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-reqinoption no nonce is added: using the-nonceoption will force addition of a nonce. If an OCSP request is being created (using-certand-serialoptions) a nonce is automatically added; specifying-no_nonceoverrides this. Nonce said what it said π₯-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.
Note that file I/O is not atomic. The output file is truncated and then written. So yeah, be cute but be careful π
-reqin file,-respin filenameβ Read OCSP request or response file from file. These option are ignored if OCSP request or response creation is implied by other options (for example with-serial,-certand-hostoptions). Read the room, not the file, in that case π-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-hostand-pathoptions described next.-host host:port,-path pathnameβ If the-hostoption is present then the OCSP request is sent to the hosthoston portport. The host may be a domain name or an IP (v4 or v6) address, such as127.0.0.1or"[::1]"for localhost. If it is 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_proxyapplies, see below. If the host string is an IPv6 address, it must be enclosed in"["and"]". The proxy port defaults to80or443if 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". Proxy behavior, but make it fashion π§-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".-header name=valueβ Adds the headernamewith the specifiedvalueto the OCSP request that is sent to the responder. This may be repeated. Header stacking, slay π-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 time 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: this option can be used to supply the necessary certificate in such cases. The input can be in PEM, DER, or PKCS#12 format.-trust_otherβ The certificates specified by the-verify_otheroption should be explicitly trusted and no additional checks will be performed on them. This is useful when the complete responder certificate chain is not available or trusting a root CA is not appropriate.-VAfile fileβ File or URI containing explicitly trusted responder certificates. Equivalent to the-verify_otherand-trust_otheroptions. 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 responders certificate. Debug mode: chaotic but valid ππ-no_internβ Ignore certificates contained in the OCSP response when searching for the signers certificate. With this option the signers certificate must be specified with either the-verify_otheror-VAfileoptions.-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 π§ͺ-no_cert_verifyβ Donβt verify the OCSP response signers 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? Thatβs wild π testing only, for real.-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 is set to be trusted for OCSP signing.-no_cert_checksβ Donβt perform any additional checks on the OCSP response signers certificate. That is do not make any checks to see if the signers certificate is authorised to provide the necessary status information: as a result this option should only be used for testing purposes. Authorization? Never heard of her (testing only) π-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 anotBeforetime and an optionalnotAftertime. 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 is5minutes.
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. Clocks are literally always fighting, so this is the tolerance arc π°οΈβ¨
-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. Digest matchy-matchy, obsessed π-digestβ picks the digest algorithm used to identify certificates inside the OCSP request. Any digest the OpenSSLdgstcommand supports is fair game π«Ά. Default isSHA-1. You can pass this option more than once β each use sets the digest for the certificate identifiers that come after it, so go wild.-CAfilefile,-no-CAfile,-CApathdir,-no-CApath,-CAstoreuri,-no-CAstoreβ bestie, these are the trusted-certificate options. Go read "Trusted Certificate Options" inopenssl-verification-options(1)for the whole tea β.-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β the whole certificate-chain verification option squad π . See "Verification Options" inopenssl-verification-options(1)for the deets on each one.-providername,-provider-pathpath,-provparam[name:]key=value,-propquerypropq β provider business β¨. Hit up "Provider Options" inopenssl(1),provider(7), andproperty(7).
π OCSP Server Options π
-indexindexfile β indexfile is the name of a text index file incaformat holding the certificate revocation info, periodt.
Okay so this is the big switch π₯: if you pass -index, the command flips into responder mode. No -index? Then you're in client mode, bestie. The request(s) the responder handles can come from the command line (via -issuer and -serial), from a file (via -reqin), or from external OCSP clients (if -port or -url is given).
Heads up π: if -index is present then -CA and -rsigner must also be present.
-CAfile β the CA certificates that match up with the revocation info in the index file you gave to-index. The input can be inPEM,DER, orPKCS#12format π¦.-rsignerfile β the certificate you sign OCSP responses with. Input can bePEM,DER, orPKCS#12format.-rkeyfile β the private key used to sign the OCSP responses. If it's not there, the file you named in-rsignergets used instead π«Ά.-passinarg β where the private key password comes from. For the format of arg checkopenssl-passphrase-options(1).-rotherfile β extra certificates to shove into the OCSP response. Input can bePEM,DER, orPKCS#12format.-rsigoptnm:v β passes options to the signature algorithm when signing OCSP responses. The names and values of these options are algorithm-specific, iykyk.-rmddigest β the digest used when signing the response β¨.-badsigβ literally corrupts the response signature before writing it out. This is for testing, bestie, not for production π.-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 instead.-portportnum β the port to listen on for OCSP requests. Both IPv4 and IPv6 are possible π. You can also set the port with the-urloption. Passing a0argument means "pick any available port automatically" β¨.-ignore_errβ ignores malformed requests or responses π. As an OCSP client, it retries if it gets a malformed response. As an OCSP responder, it keeps running instead of terminating when a malformed request arrives.-nrequestnumber β the OCSP server exits after receiving number requests. Default is unlimited.-multiprocess-count β runs that many OCSP responder child processes, and the parent respawns children as needed π. Child processes notice changes in the CA index file and automatically reload it. When running as a responder, the-timeoutoption is recommended to limit how long each child waits for the client's OCSP response. This option is available on POSIX systems (the ones that supportfork()and the other required unix system calls).-nminminutes,-ndaysdays β how many minutes or days the fresh revocation information is good for: this goes in thenextUpdatefield. If neither option is present, thenextUpdatefield is omitted entirely, which means fresh revocation information is immediately available β.
πΈ OCSP RESPONSE VERIFICATION πΈ
OCSP Response follows the rules specified in RFC2560, no cap.
First the OCSP responder certificate gets located, and the signature on the OCSP request is checked using the responder certificate's public key π.
Then a normal certificate verify runs on the OCSP responder certificate, building up a certificate chain along the way. You can say where the trusted certificates for building that chain live with the -CAfile, -CApath or -CAstore options β otherwise they get looked for in the standard OpenSSL certificates directory π.
If that initial verify fails, the OCSP verify process halts with an error π.
Otherwise, the issuing CA certificate in the request gets compared against the OCSP responder certificate: match found? OCSP verify succeeds β .
Otherwise, the OCSP responder certificate's CA is checked against the issuing CA certificate in the request. If those match and the OCSPSigning extended key usage is present in the OCSP responder certificate, then OCSP verify succeeds.
Otherwise β if -no_explicit is not set β the root CA of the OCSP responder's CA gets checked to see if it's trusted for OCSP signing. If it is, OCSP verify succeeds π.
If none of these checks work out, OCSP verify fails. Periodt.
What this effectively means is: 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. Like this:
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 π
.
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 can't respond to new requests until it's finished processing the current one π. The text index file format of revocation is also inefficient for large quantities of revocation data.
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 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 β.
π 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>.
okay that's the whole page bestie, mwah π β this was OpenSSL 3.5.0, dated 2026-09-25, aka OPENSSL-OCSP(1ossl). go forth and revoke responsibly πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms