1ocsptool(1)                      User Commands                     ocsptool(1)
2
3
4

NAME

6       ocsptool - GnuTLS OCSP tool
7

SYNOPSIS

9       ocsptool [-flags] [-flag [value]] [--option-name[[=| ]value]]
10
11       All arguments must be options.
12
13

DESCRIPTION

15       On verification
16       Responses  are  typically  signed/issued  by designated certificates or
17       certificate authorities and thus this tool requires on verification the
18       certificate of the issuer or the full certificate chain in order to de‐
19       termine the appropriate signing authority. The specified certificate of
20       the issuer is assumed trusted.
21

OPTIONS

23       -d number, --debug=number
24              Enable  debugging.   This  option takes an integer number as its
25              argument.  The value of number is constrained to being:
26                  in the range  0 through 9999
27
28              Specifies the debug level.
29
30       -V, --verbose
31              More verbose output.  This option may appear an unlimited number
32              of times.
33
34
35       --infile=file
36              Input file.
37
38
39       --outfile=string
40              Output file.
41
42
43       --ask [=server name|url]
44              Ask an OCSP/HTTP server on a certificate validity.
45
46              Connects to the specified HTTP OCSP server and queries on the
47              validity of the loaded certificate.  Its argument can be a URL
48              or a plain server name. It can be combined with --load-chain,
49              where it checks all certificates in the provided chain, or with
50              --load-cert and --load-issuer options. The latter checks the
51              provided certificate against its specified issuer certificate.
52
53       -e, --verify-response
54              Verify response.
55
56              Verifies the provided OCSP response against the system trust an‐
57              chors (unless --load-trust is provided). It requires the --load-
58              signer or --load-chain options to obtain the signer of the OCSP
59              response.
60
61       -i, --request-info
62              Print information on a OCSP request.
63
64              Display detailed information on the provided OCSP request.
65
66       -j, --response-info
67              Print information on a OCSP response.
68
69              Display detailed information on the provided OCSP response.
70
71       -q, --generate-request
72              Generates an OCSP request.
73
74
75       --nonce, --no-nonce
76              Use (or not) a nonce to OCSP request.  The no-nonce form will
77              disable the option.
78
79
80       --load-chain=file
81              Reads a set of certificates forming a chain from file.
82
83
84       --load-issuer=file
85              Reads issuer's certificate from file.
86
87
88       --load-cert=file
89              Reads the certificate to check from file.
90
91
92       --load-trust=file
93              Read OCSP trust anchors from file.  This option must not appear
94              in combination with any of the following options: load-signer.
95
96              When verifying an OCSP response read the trust anchors from the
97              provided file. When this is not provided, the system's trust an‐
98              chors will be used.
99
100       --load-signer=file
101              Reads the OCSP response signer from file.  This option must not
102              appear in combination with any of the following options: load-
103              trust.
104
105
106       --inder, --no-inder
107              Use DER format for input certificates and private keys.  The
108              no-inder form will disable the option.
109
110
111       --outder
112              Use DER format for output of responses (this is the default).
113
114              The output will be in DER encoded format. Unlike other GnuTLS
115              tools, this is the default for this tool
116
117       --outpem
118              Use PEM format for output of responses.
119
120              The output will be in PEM format.
121
122       -Q file, --load-request=file
123              Reads the DER encoded OCSP request from file.
124
125
126       -S file, --load-response=file
127              Reads the DER encoded OCSP response from file.
128
129
130       --ignore-errors
131              Ignore any verification errors.
132
133
134       --verify-allow-broken
135              Allow broken algorithms, such as MD5 for verification.
136
137              This can be combined with --verify-response.
138
139       -h, --help
140              Display usage information and exit.
141
142       -!, --more-help
143              Pass the extended usage information through a pager.
144
145       -v [{v|c|n --version [{v|c|n}]}]
146              Output version of program and exit.  The default mode is `v', a
147              simple version.  The `c' mode will print copyright information
148              and `n' will print the full copyright notice.
149

EXAMPLES

151       Print information about an OCSP request
152
153       To parse an OCSP request and print information about the content, the
154       -i or --request-info parameter may be used as follows.  The -Q parame‐
155       ter specify the name of the file containing the OCSP request, and it
156       should contain the OCSP request in binary DER format.
157
158           $ ocsptool -i -Q ocsp-request.der
159
160       The input file may also be sent to standard input like this:
161
162           $ cat ocsp-request.der | ocsptool --request-info
163
164       Print information about an OCSP response
165
166       Similar to parsing OCSP requests, OCSP responses can be parsed using
167       the -j or --response-info as follows.
168
169           $ ocsptool -j -Q ocsp-response.der
170           $ cat ocsp-response.der | ocsptool --response-info
171
172       Generate an OCSP request
173
174       The -q or --generate-request parameters are used to generate an OCSP
175       request.  By default the OCSP request is written to standard output in
176       binary DER format, but can be stored in a file using --outfile.  To
177       generate an OCSP request the issuer of the certificate to check needs
178       to be specified with --load-issuer and the certificate to check with
179       --load-cert.  By default PEM format is used for these files, although
180       --inder can be used to specify that the input files are in DER format.
181
182           $ ocsptool -q --load-issuer issuer.pem --load-cert client.pem            --outfile ocsp-request.der
183
184       When generating OCSP requests, the tool will add an OCSP extension con‐
185       taining a nonce.  This behaviour can be disabled by specifying
186       --no-nonce.
187
188       Verify signature in OCSP response
189
190       To verify the signature in an OCSP response the -e or --verify-response
191       parameter is used.  The tool will read an OCSP response in DER format
192       from standard input, or from the file specified by --load-response.
193       The OCSP response is verified against a set of trust anchors, which are
194       specified using --load-trust.  The trust anchors are concatenated cer‐
195       tificates in PEM format.  The certificate that signed the OCSP response
196       needs to be in the set of trust anchors, or the issuer of the signer
197       certificate needs to be in the set of trust anchors and the OCSP Ex‐
198       tended Key Usage bit has to be asserted in the signer certificate.
199
200           $ ocsptool -e --load-trust issuer.pem            --load-response ocsp-response.der
201
202       The tool will print status of verification.
203
204       Verify signature in OCSP response against given certificate
205
206       It is possible to override the normal trust logic if you know that a
207       certain certificate is supposed to have signed the OCSP response, and
208       you want to use it to check the signature.  This is achieved using
209       --load-signer instead of --load-trust.  This will load one certificate
210       and it will be used to verify the signature in the OCSP response.  It
211       will not check the Extended Key Usage bit.
212
213           $ ocsptool -e --load-signer ocsp-signer.pem            --load-response ocsp-response.der
214
215       This approach is normally only relevant in two situations.  The first
216       is when the OCSP response does not contain a copy of the signer cer‐
217       tificate, so the --load-trust code would fail.  The second is if you
218       want to avoid the indirect mode where the OCSP response signer certifi‐
219       cate is signed by a trust anchor.
220
221       Real-world example
222
223       Here is an example of how to generate an OCSP request for a certificate
224       and to verify the response.  For illustration we'll use the blog.josef‐
225       sson.org host, which (as of writing) uses a certificate from CACert.
226       First we'll use gnutls-cli to get a copy of the server certificate
227       chain.  The server is not required to send this information, but this
228       particular one is configured to do so.
229
230           $ echo | gnutls-cli -p 443 blog.josefsson.org --save-cert chain.pem
231
232       The saved certificates normally contain a pointer to where the OCSP re‐
233       sponder is located, in the Authority Information Access Information ex‐
234       tension.  For example, from certtool -i < chain.pem there is this in‐
235       formation:
236
237           Authority Information Access Information (not critical):
238           Access Method: 1.3.6.1.5.5.7.48.1 (id-ad-ocsp)
239           Access Location URI: https://ocsp.CAcert.org/
240
241       This means that ocsptool can discover the servers to contact over HTTP.
242       We can now request information on the chain certificates.
243
244           $ ocsptool --ask --load-chain chain.pem
245
246       The request is sent via HTTP to the OCSP server address found in the
247       certificates. It is possible to override the address of the OCSP server
248       as well as ask information on a particular certificate using
249       --load-cert and --load-issuer.
250
251           $ ocsptool --ask https://ocsp.CAcert.org/ --load-chain chain.pem
252
253

EXIT STATUS

255       One of the following exit values will be returned:
256
257       0  (EXIT_SUCCESS)
258              Successful program execution.
259
260       1  (EXIT_FAILURE)
261              The operation failed or the command syntax was not valid.
262
263       70  (EX_SOFTWARE)
264              libopts had an internal operational error.  Please report it to
265              autogen-users@lists.sourceforge.net.  Thank you.
266

SEE ALSO

268           certtool (1)
269

AUTHORS

271       Nikos Mavrogiannopoulos, Simon Josefsson and others; see
272       /usr/share/doc/gnutls/AUTHORS for a complete list.
273
275       Copyright (C) 2000-2020 Free Software Foundation, and others all rights
276       reserved.  This program is released under the terms of the GNU General
277       Public License, version 3 or later.
278

BUGS

280       Please send bug reports to: bugs@gnutls.org
281

NOTES

283       This manual page was AutoGen-erated from the ocsptool option defini‐
284       tions.
285
286
287
2883.7.2                             29 May 2021                      ocsptool(1)
Impressum