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 certificatefilenameto 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-certoption, except the certificate with serial numbernumis 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-signerand 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-reqinoption, no nonce is added β so using-nonceforces the nonce to be added. but if an OCSP request is being created (with the-certand-serialoptions) a nonce is added automatically, and specifying-no_nonceoverrides 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 tofilename. 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 fromfile. these options are ignored if OCSP request or response creation is implied by other options (for example with the-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-hostis 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, like127.0.0.1or"[::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_proxyapplies (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 headernamewith the specifiedvalueto 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_othershould 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_otherand-trust_otheroptions 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_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.-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 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's and the client's clocks may not be precisely synchronised, so such a check may fail. to avoid that, the-validity_periodoption 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 theopenssl-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 OpenSSLdgstcommand supports is fair game. Default isSHA-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β 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β all of these set various options for certificate chain verification. See βVerification Optionsβ inopenssl-verification-options(1)for the details. No cap, it's all there. π-provider nameβ see βProvider Optionsβ inopenssl(1),provider(7), andproperty(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 seeopenssl(1),provider(7), andproperty(7). π-propquery propqβ property query, seeopenssl(1),provider(7), andproperty(7). π
π₯ OCSP Server Options π₯
-index indexfileβindexfileis the name of a text index file incaformat 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-issuerand-serial), supplied in a file (using-reqin), or come in via external OCSP clients (if-portor-urlis specified). If-indexis present, then-CAand-rsignermust 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 inPEM,DER, orPKCS#12format. π-rsigner fileβ the certificate to sign OCSP responses with. Input can bePEM,DER, orPKCS#12. ποΈ-rkey fileβ the private key to sign OCSP responses with. If this isn't present, the file specified in-rsigneris used. π-passin argβ the private key password source. For the format ofarg, seeopenssl-passphrase-options(1). π-rother fileβ additional certificates to include in the OCSP response. Input can bePEM,DER, orPKCS#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-urloption. A0argument 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 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,-timeoutis 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 supportfork()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. 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 Β©οΈ
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
- ubuntu stonking: openssl 4.0.3-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms