ocsptool(1)
π NAME π
ocsptool β the GnuTLS OCSP tool π
(yes bestie, you're on the ocsptool(1) page, you found it, slay)
β¨ SYNOPSIS β¨
ocsptool [-flags] [-flag [value]] [--option-name[[=| ]value]]
okay so important vibe check: all arguments must be options. like, every single one. no sneaky positional args here, she doesn't do that π«Ά
πΈ DESCRIPTION πΈ
π¦ On verification
So here's the tea π΅ β responses are typically signed/issued by designated certificates or certificate authorities, which means this tool needs the certificate of the issuer, or the whole full certificate chain, at verification time, so it can figure out the appropriate signing authority. And the specified certificate of the issuer? Assumed trusted. periodt. no cap.
π OPTIONS π
-d num,--debug=numβ enables debugging π. This one takes an integer number as its argument, andnumis constrained to being: in the range 0 through 9999. Specifies the debug level.-V,--verboseβ more verbose output. she talks more π¬--infile=fileβ input file.--outfile=strβ output file.--ask=server name|urlβ ask an OCSP/HTTP server on a certificate validity πββοΈ. Connects to the specified HTTP OCSP server and queries on the validity of the loaded certificate. Its argument can be a URL or a plain server name. It can be combined with--load-chain, where it checks all certificates in the provided chain, or with--load-certand--load-issueroptions. The latter checks the provided certificate against its specified issuer certificate.-e,--verify-responseβ verify response β . Verifies the provided OCSP response against the system trust anchors (unless--load-trustis provided). It requires the--load-signeror--load-chainoptions to obtain the signer of the OCSP response.-i,--request-infoβ print information on a OCSP request π. Display detailed information on the provided OCSP request.-j,--response-infoβ print information on a OCSP response πβ¨. Display detailed information on the provided OCSP response.-q,--generate-requestβ generates an OCSP request ποΈ.--nonce,--no-nonceβ use (or not) a nonce to OCSP request. Theno-nonceform will disable the option.--load-chain=fileβ reads a set of certificates forming a chain from file βοΈ.--load-issuer=fileβ reads issuer's certificate from file.--load-cert=fileβ reads the certificate to check from file.--load-trust=fileβ read OCSP trust anchors from file π. This option must not appear in combination with any of the following options:load-signer. When verifying an OCSP response read the trust anchors from the provided file. When this is not provided, the system's trust anchors will be used.--load-signer=fileβ reads the OCSP response signer from file βοΈ. This option must not appear in combination with any of the following options:load-trust.--inder,--no-inderβ use DER format for input certificates and private keys. Theno-inderform will disable the option.--outderβ use DER format for output of responses (this is the default). The output will be in DER encoded format. Unlike other GnuTLS tools, this is the default for this tool. main character behaviour honestly π--outpemβ use PEM format for output of responses. The output will be in PEM format.-Q file,--load-request=fileβ reads the DER encoded OCSP request from file.-S file,--load-response=fileβ reads the DER encoded OCSP response from file.--ignore-errorsβ ignore any verification errors π.--verify-allow-brokenβ allow broken algorithms, such as MD5 for verification π. This can be combined with--verify-response.--attime=timestampβ perform validation at the timestamp instead of the system time β°.timestampis an instance in time encoded as Unix time or in a human readable timestring such as"29 Feb 2004","2004-02-29". Full documentation available athttps://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.htmlor locally viainfo '(coreutils) date invocation'.-v arg,--version=argβ output version of program and exit. The default mode isv, a simple version. Thecmode will print copyright information andnwill print the full copyright notice.-h,--helpβ display usage information and exit π.-!,--more-helpβ pass the extended usage information through a pager π.
π§ͺ EXAMPLES π§ͺ
π Print information about an OCSP request
To parse an OCSP request and print information about the content, the -i or --request-info parameter may be used as follows. The -Q parameter specify the name of the file containing the OCSP request, and it should contain the OCSP request in binary DER format.
$ ocsptool -i -Q ocsp-request.der
The input file may also be sent to standard input like this:
$ cat ocsp-request.der | ocsptool --request-info
π Print information about an OCSP response
Similar to parsing OCSP requests, OCSP responses can be parsed using the -j or --response-info as follows.
$ ocsptool -j -Q ocsp-response.der
$ cat ocsp-response.der | ocsptool --response-info
ποΈ Generate an OCSP request
The -q or --generate-request parameters are used to generate an OCSP request. By default the OCSP request is written to standard output in binary DER format, but can be stored in a file using --outfile. To generate an OCSP request the issuer of the certificate to check needs to be specified with --load-issuer and the certificate to check with --load-cert. By default PEM format is used for these files, although --inder can be used to specify that the input files are in DER format.
$ ocsptool -q --load-issuer issuer.pem --load-cert client.pem --outfile ocsp-request.der
When generating OCSP requests, the tool will add an OCSP extension containing a nonce. This behaviour can be disabled by specifying --no-nonce.
β Verify signature in OCSP response
To verify the signature in an OCSP response the -e or --verify-response parameter is used. The tool will read an OCSP response in DER format from standard input, or from the file specified by --load-response. The OCSP response is verified against a set of trust anchors, which are specified using --load-trust. The trust anchors are concatenated certificates in PEM format. The certificate that signed the OCSP response needs to be in the set of trust anchors, or the issuer of the signer certificate needs to be in the set of trust anchors and the OCSP Extended Key Usage bit has to be asserted in the signer certificate.
$ ocsptool -e --load-trust issuer.pem --load-response ocsp-response.der
The tool will print status of verification.
β Verify signature in OCSP response against given certificate
It is possible to override the normal trust logic if you know that a certain certificate is supposed to have signed the OCSP response, and you want to use it to check the signature. This is achieved using --load-signer instead of --load-trust. This will load one certificate and it will be used to verify the signature in the OCSP response. It will not check the Extended Key Usage bit.
$ ocsptool -e --load-signer ocsp-signer.pem --load-response ocsp-response.der
This approach is normally only relevant in two situations. The first is when the OCSP response does not contain a copy of the signer certificate, so the --load-trust code would fail. The second is if you want to avoid the indirect mode where the OCSP response signer certificate is signed by a trust anchor.
π Real-world example
Here is an example of how to generate an OCSP request for a certificate and to verify the response. For illustration we'll use the blog.josefsson.org host, which (as of writing) uses a certificate from CACert. First we'll use gnutls-cli to get a copy of the server certificate chain. The server is not required to send this information, but this particular one is configured to do so.
$ echo | gnutls-cli -p 443 blog.josefsson.org --save-cert chain.pem
The saved certificates normally contain a pointer to where the OCSP responder is located, in the Authority Information Access Information extension. For example, from certtool -i < chain.pem there is this information:
Authority Information Access Information (not critical):
Access Method: 1.3.6.1.5.5.7.48.1 (id-ad-ocsp)
Access Location URI: https://ocsp.CAcert.org/
This means that ocsptool can discover the servers to contact over HTTP. We can now request information on the chain certificates.
$ ocsptool --ask --load-chain chain.pem
The request is sent via HTTP to the OCSP server address found in the certificates. It is possible to override the address of the OCSP server as well as ask information on a particular certificate using --load-cert and --load-issuer.
$ ocsptool --ask https://ocsp.CAcert.org/ --load-chain chain.pem
πͺ EXIT STATUS πͺ
One of the following exit values will be returned:
0(EXIT_SUCCESS) β Successful program execution. π she ate and left no crumbs.1(EXIT_FAILURE) β The operation failed or the command syntax was not valid. π it's giving error.
π SEE ALSO π
certtool (1)
(go read that one too bestie, iykyk π)
βοΈ AUTHORS βοΈ
okay so this section is literally empty in the original. nothing here. a void. an aesthetic blank space π³οΈβ¨ β no names were listed, and i'm not about to make any up.
Β©οΈ COPYRIGHT Β©οΈ
Copyright (C) 2020-2023 Free Software Foundation, and others all rights reserved. This program is released under the terms of the GNU General Public License, version 3 or later. π«Ά
π BUGS π
Please send bug reports to: bugs@gnutls.org π¬ (be nice to them, they're doing their best π)
and that's the whole page bestie!! π
β¨ this was ocsptool from GnuTLS version 3.8.13, dated 29 Apr 2026 πΈ mwah, go forth and verify some OCSP responses πΈ
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-utils 3.8.13-1.fc43 Β· GPL-3.0-or-later
- fedora 44: gnutls-utils 3.8.13-1.fc44 Β· GPL-3.0-or-later
- nixpkgs unstable: gnutls 3.8.13
- ubuntu stonking: gnutls-bin 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms