OPENSSL-OCSP(1ossl)
πΈ NAME πΈ
welcome to OPENSSL-OCSP(1ossl), bestie π
this is openssl-ocsp β the Online Certificate Status Protocol command. it's the OCSP tool, and it's lowkey iconic π
β¨ 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 literally how applications figure out the (revocation) state of an identified certificate (RFC 2560). no cap, that's the whole vibe check π₯
this command performs many 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 π«Ά
π OPTIONS π
this command operates as either a client or a server. the options are described below, divided into those two modes π
π OCSP Client Options π
-helpβ print out a usage message. short and sweet π-out filenameβ specify the output filename; default is standard output.-issuer filenameβ this specifies the current issuer certificate. the input can be inPEM,DER, orPKCS#12format.
this option can be used multiple times. this option MUST come before any -cert options. like, don't skip that part, bestie π
-cert filenameβ add the certificatefilenameto the request. the input can be inPEM,DER, orPKCS#12format.
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. so yeah, set your issuer first β¨
-no_certsβ don't include any certificates in a signed request. simple as that.-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 inPEM,DER, orPKCS#12format.
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 signer, no signature β it's giving unsigned, respectfully π«Ά
-sign_other filenameβ additional certificates to include in the signed request. the input can be inPEM,DER, orPKCS#12format.-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, and specifying-no_nonceoverrides this.-req_text,-resp_text,-textβ print out the text form of the OCSP request, response, or both respectively. text mode, slay β¨-reqout file,-respout filenameβ write out the DER-encoded OCSP request or response tofilename. 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, like, don't be messy with this one π
-reqin file,-respin filenameβ read OCSP request or response file fromfile. these options are ignored if OCSP request or response creation is implied by other options (for example with-serial,-cert, and-hostoptions).-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 variablehttp_proxyif set, elseHTTP_PROXYin case no TLS is used, otherwisehttps_proxyif set, elseHTTPS_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 (where in the latter case the whole argument must be enclosed in"..."). default is from the environment variableno_proxyif set, elseNO_PROXY.-header name=valueβ adds the headernamewith the specifiedvalueto the OCSP request that is sent to the responder. this may be repeated. header stacking, we love to see it π-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 inPEM,DER, orPKCS#12format.-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 inPEM,DER, orPKCS#12format.-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. debug-only energy, okay? π-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_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, for real π-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 is set to be trusted for OCSP signing.-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.-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 client's 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.
-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β sets the digest algorithm used for certificate identification in the OCSP request, bestie. Any digest supported by the OpenSSLdgstcommand can be used, and the default isSHA-1. You can use this option multiple times to specify the digest used by subsequent certificate identifiers. π-CAfile file,-no-CAfile,-CApath dir,-no-CApath,-CAstore uri,-no-CAstoreβ see "Trusted Certificate Options" inopenssl-verification-options(1)for the details, okay? π«Ά-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β these set various options for certificate chain verification. See "Verification Options" inopenssl-verification-options(1)for all the tea. β¨-provider name,-provider-path path,-provparam [name:]key=value,-propquery propqβ see "Provider Options" inopenssl(1),provider(7), andproperty(7). π§
π OCSP Server Options π
-index indexfileβ theindexfileparameter is the name of a text index file incaformat containing certificate revocation information. If the-indexoption is specified then this command switches to responder mode, otherwise it is in client mode. The request(s) the responder processes can be either specified on the command line (using-issuerand-serialoptions), supplied in a file (using the-reqinoption), or via external OCSP clients (if-portor-urlis specified). If the-indexoption is present then the-CAand-rsigneroptions must also be present. π-CA fileβ CA certificates corresponding to the revocation information in the index file given with-index. The input can be inPEM,DER, orPKCS#12format. π¦-rsigner fileβ the certificate to sign OCSP responses with. The input can be inPEM,DER, orPKCS#12format. πΈ-rkey fileβ the private key to sign OCSP responses with: if not present, the file specified in the-rsigneroption is used. π-passin argβ the private key password source. For more info about the format ofarg, seeopenssl-passphrase-options(1). π-rother fileβ additional certificates to include in the OCSP response. The input can be inPEM,DER, orPKCS#12format. π-rsigopt nm:vβ pass options to the signature algorithm when signing OCSP responses. Names and values of these options are algorithm-specific. β¨-rmd digestβ the digest to use when signing the response. π-badsigβ corrupt the response signature before writing it; this can be useful for testing. π-resp_no_certsβ don't include any certificates in the OCSP response. π-resp_key_idβ identify the signer certificate using the key ID; the default is to use the subject name. π«Ά-port portnumβ port to listen for OCSP requests on. BothIPv4andIPv6are possible. The port may also be specified using the-urloption. A0argument indicates that 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 receivingnumberrequests; 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, the-timeoutoption 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 thefork()and other required unix system-calls). π§-nmin minutes,-ndays daysβ number of minutes or days when fresh revocation information is available: used in thenextUpdatefield. If neither option is present then thenextUpdatefield is omitted, meaning fresh revocation information is immediately available. πΈ
π OCSP RESPONSE VERIFICATION π
OCSP Response follows the rules specified in RFC2560. π
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 responder's 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. π
Basically what this 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. π«Ά
Real talk, bestie: 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. π
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 Β©οΈ
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 vibe, bestie π
this iconic page is OpenSSL 3.5.6, dated 2026-04-07, and it goes by OPENSSL-OCSP(1ossl) β slay and verify responsibly πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms