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       Ocsptool  is  a program that can parse and print information about OCSP
16       requests/responses, generate requests and verify responses.
17
18

OPTIONS

20       -d number, --debug=number
21              Enable debugging.  This option takes an integer  number  as  its
22              argument.  The value of number is constrained to being:
23                  in the range  0 through 9999
24
25              Specifies the debug level.
26
27       -V, --verbose
28              More verbose output.  This option may appear an unlimited number
29              of times.
30
31
32       --infile=file
33              Input file.
34
35
36       --outfile=string
37              Output file.
38
39
40       --ask [=server name|url]
41              Ask an OCSP/HTTP server on a certificate validity.  This option
42              must appear in combination with the following options: load-
43              cert, load-issuer.
44
45              Connects to the specified HTTP OCSP server and queries on the
46              validity of the loaded certificate.
47
48       -e, --verify-response
49              Verify response.
50
51
52       -i, --request-info
53              Print information on a OCSP request.
54
55
56       -j, --response-info
57              Print information on a OCSP response.
58
59
60       -q, --generate-request
61              Generate an OCSP request.
62
63
64       --nonce, --no-nonce
65              Use (or not) a nonce to OCSP request.  The no-nonce form will
66              disable the option.
67
68
69       --load-issuer=file
70              Read issuer certificate from file.
71
72
73       --load-cert=file
74              Read certificate to check from file.
75
76
77       --load-trust=file
78              Read OCSP trust anchors from file.  This option must not appear
79              in combination with any of the following options: load-signer.
80
81
82       --load-signer=file
83              Read OCSP response signer from file.  This option must not
84              appear in combination with any of the following options: load-
85              trust.
86
87
88       --inder, --no-inder
89              Use DER format for input certificates and private keys.  The
90              no-inder form will disable the option.
91
92
93       -Q file, --load-request=file
94              Read DER encoded OCSP request from file.
95
96
97       -S file, --load-response=file
98              Read DER encoded OCSP response from file.
99
100
101       -h, --help
102              Display usage information and exit.
103
104       -!, --more-help
105              Pass the extended usage information through a pager.
106
107       -v [{v|c|n --version [{v|c|n}]}]
108              Output version of program and exit.  The default mode is `v', a
109              simple version.  The `c' mode will print copyright information
110              and `n' will print the full copyright notice.
111

EXAMPLES

113       Print information about an OCSP request
114
115       To parse an OCSP request and print information about the content, the
116       -i or --request-info parameter may be used as follows.  The -Q parame‐
117       ter specify the name of the file containing the OCSP request, and it
118       should contain the OCSP request in binary DER format.
119
120           $ ocsptool -i -Q ocsp-request.der
121
122       The input file may also be sent to standard input like this:
123
124           $ cat ocsp-request.der | ocsptool --request-info
125
126       Print information about an OCSP response
127
128       Similar to parsing OCSP requests, OCSP responses can be parsed using
129       the -j or --response-info as follows.
130
131           $ ocsptool -j -Q ocsp-response.der
132           $ cat ocsp-response.der | ocsptool --response-info
133
134       Generate an OCSP request
135
136       The -q or --generate-request parameters are used to generate an OCSP
137       request.  By default the OCSP request is written to standard output in
138       binary DER format, but can be stored in a file using --outfile.  To
139       generate an OCSP request the issuer of the certificate to check needs
140       to be specified with --load-issuer and the certificate to check with
141       --load-cert.  By default PEM format is used for these files, although
142       --inder can be used to specify that the input files are in DER format.
143
144           $ ocsptool -q --load-issuer issuer.pem --load-cert client.pem            --outfile ocsp-request.der
145
146       When generating OCSP requests, the tool will add an OCSP extension con‐
147       taining a nonce.  This behaviour can be disabled by specifying
148       --no-nonce.
149
150       Verify signature in OCSP response
151
152       To verify the signature in an OCSP response the -e or --verify-response
153       parameter is used.  The tool will read an OCSP response in DER format
154       from standard input, or from the file specified by --load-response.
155       The OCSP response is verified against a set of trust anchors, which are
156       specified using --load-trust.  The trust anchors are concatenated cer‐
157       tificates in PEM format.  The certificate that signed the OCSP response
158       needs to be in the set of trust anchors, or the issuer of the signer
159       certificate needs to be in the set of trust anchors and the OCSP
160       Extended Key Usage bit has to be asserted in the signer certificate.
161
162           $ ocsptool -e --load-trust issuer.pem            --load-response ocsp-response.der
163
164       The tool will print status of verification.
165
166       Verify signature in OCSP response against given certificate
167
168       It is possible to override the normal trust logic if you know that a
169       certain certificate is supposed to have signed the OCSP response, and
170       you want to use it to check the signature.  This is achieved using
171       --load-signer instead of --load-trust.  This will load one certificate
172       and it will be used to verify the signature in the OCSP response.  It
173       will not check the Extended Key Usage bit.
174
175           $ ocsptool -e --load-signer ocsp-signer.pem            --load-response ocsp-response.der
176
177       This approach is normally only relevant in two situations.  The first
178       is when the OCSP response does not contain a copy of the signer cer‐
179       tificate, so the --load-trust code would fail.  The second is if you
180       want to avoid the indirect mode where the OCSP response signer certifi‐
181       cate is signed by a trust anchor.
182
183       Real-world example
184
185       Here is an example of how to generate an OCSP request for a certificate
186       and to verify the response.  For illustration we'll use the blog.josef‐
187       sson.org host, which (as of writing) uses a certificate from CACert.
188       First we'll use gnutls-cli to get a copy of the server certificate
189       chain.  The server is not required to send this information, but this
190       particular one is configured to do so.
191
192           $ echo | gnutls-cli -p 443 blog.josefsson.org --print-cert > chain.pem
193
194       Use a text editor on chain.pem to create three files for each separate
195       certificates, called cert.pem for the first certificate for the domain
196       itself, secondly issuer.pem for the intermediate certificate and
197       root.pem for the final root certificate.
198
199       The domain certificate normally contains a pointer to where the OCSP
200       responder is located, in the Authority Information Access Information
201       extension.  For example, from certtool -i < cert.pem there is this
202       information:
203
204           Authority Information Access Information (not critical):
205           Access Method: 1.3.6.1.5.5.7.48.1 (id-ad-ocsp)
206           Access Location URI: http://ocsp.CAcert.org/
207
208       This means the CA support OCSP queries over HTTP.  We are now ready to
209       create a OCSP request for the certificate.
210
211           $ ocsptool --ask ocsp.CAcert.org --load-issuer issuer.pem            --load-cert cert.pem --outfile ocsp-response.der
212
213       The request is sent via HTTP to the OCSP server address specified. If
214       the address is ommited ocsptool will use the address stored in the cer‐
215       tificate.
216
217

EXIT STATUS

219       One of the following exit values will be returned:
220
221       0  (EXIT_SUCCESS)
222              Successful program execution.
223
224       1  (EXIT_FAILURE)
225              The operation failed or the command syntax was not valid.
226
227       70  (EX_SOFTWARE)
228              libopts had an internal operational error.  Please report it to
229              autogen-users@lists.sourceforge.net.  Thank you.
230

SEE ALSO

232           certtool (1)
233

AUTHORS

235       Nikos Mavrogiannopoulos, Simon Josefsson and others; see
236       /usr/share/doc/gnutls/AUTHORS for a complete list.
237
239       Copyright (C) 2000-2018 Free Software Foundation, and others all rights
240       reserved.  This program is released under the terms of the GNU General
241       Public License, version 3 or later.
242

BUGS

244       Please send bug reports to: bugs@gnutls.org
245

NOTES

247       This manual page was AutoGen-erated from the ocsptool option defini‐
248       tions.
249
250
251
2523.3.29                            16 Feb 2018                      ocsptool(1)
Impressum