1OCSP(1) OpenSSL OCSP(1)
2
3
4
6 openssl-ocsp, ocsp - Online Certificate Status Protocol utility
7
9 openssl ocsp [-help] [-out file] [-issuer file] [-cert file] [-serial
10 n] [-signer file] [-signkey file] [-sign_other file] [-no_certs]
11 [-req_text] [-resp_text] [-text] [-reqout file] [-respout file] [-reqin
12 file] [-respin file] [-nonce] [-no_nonce] [-url URL] [-host host:port]
13 [-multi process-count] [-header] [-path] [-CApath dir] [-CAfile file]
14 [-no-CAfile] [-no-CApath] [-attime timestamp] [-check_ss_sig]
15 [-crl_check] [-crl_check_all] [-explicit_policy] [-extended_crl]
16 [-ignore_critical] [-inhibit_any] [-inhibit_map] [-no_check_time]
17 [-partial_chain] [-policy arg] [-policy_check] [-policy_print]
18 [-purpose purpose] [-suiteB_128] [-suiteB_128_only] [-suiteB_192]
19 [-trusted_first] [-no_alt_chains] [-use_deltas] [-auth_level num]
20 [-verify_depth num] [-verify_email email] [-verify_hostname hostname]
21 [-verify_ip ip] [-verify_name name] [-x509_strict] [-VAfile file]
22 [-validity_period n] [-status_age n] [-noverify] [-verify_other file]
23 [-trust_other] [-no_intern] [-no_signature_verify] [-no_cert_verify]
24 [-no_chain] [-no_cert_checks] [-no_explicit] [-port num] [-ignore_err]
25 [-index file] [-CA file] [-rsigner file] [-rkey file] [-rother file]
26 [-rsigopt nm:v] [-resp_no_certs] [-nmin n] [-ndays n] [-resp_key_id]
27 [-nrequest n] [-digest]
28
30 The Online Certificate Status Protocol (OCSP) enables applications to
31 determine the (revocation) state of an identified certificate (RFC
32 2560).
33
34 The ocsp command performs many common OCSP tasks. It can be used to
35 print out requests and responses, create requests and send queries to
36 an OCSP responder and behave like a mini OCSP server itself.
37
39 This command operates as either a client or a server. The options are
40 described below, divided into those two modes.
41
42 OCSP Client Options
43 -help
44 Print out a usage message.
45
46 -out filename
47 specify output filename, default is standard output.
48
49 -issuer filename
50 This specifies the current issuer certificate. This option can be
51 used multiple times. The certificate specified in filename must be
52 in PEM format. This option MUST come before any -cert options.
53
54 -cert filename
55 Add the certificate filename to the request. The issuer certificate
56 is taken from the previous issuer option, or an error occurs if no
57 issuer certificate is specified.
58
59 -serial num
60 Same as the cert option except the certificate with serial number
61 num is added to the request. The serial number is interpreted as a
62 decimal integer unless preceded by 0x. Negative integers can also
63 be specified by preceding the value by a - sign.
64
65 -signer filename, -signkey filename
66 Sign the OCSP request using the certificate specified in the signer
67 option and the private key specified by the signkey option. If the
68 signkey option is not present then the private key is read from the
69 same file as the certificate. If neither option is specified then
70 the OCSP request is not signed.
71
72 -sign_other filename
73 Additional certificates to include in the signed request.
74
75 -nonce, -no_nonce
76 Add an OCSP nonce extension to a request or disable OCSP nonce
77 addition. Normally if an OCSP request is input using the reqin
78 option no nonce is added: using the nonce option will force
79 addition of a nonce. If an OCSP request is being created (using
80 cert and serial options) a nonce is automatically added specifying
81 no_nonce overrides this.
82
83 -req_text, -resp_text, -text
84 Print out the text form of the OCSP request, response or both
85 respectively.
86
87 -reqout file, -respout file
88 Write out the DER encoded certificate request or response to file.
89
90 -reqin file, -respin file
91 Read OCSP request or response file from file. These option are
92 ignored if OCSP request or response creation is implied by other
93 options (for example with serial, cert and host options).
94
95 -url responder_url
96 Specify the responder URL. Both HTTP and HTTPS (SSL/TLS) URLs can
97 be specified.
98
99 -host hostname:port, -path pathname
100 If the host option is present then the OCSP request is sent to the
101 host hostname on port port. path specifies the HTTP path name to
102 use or "/" by default. This is equivalent to specifying -url with
103 scheme http:// and the given hostname, port, and pathname.
104
105 -header name=value
106 Adds the header name with the specified value to the OCSP request
107 that is sent to the responder. This may be repeated.
108
109 -timeout seconds
110 Connection timeout to the OCSP responder in seconds. On POSIX
111 systems, when running as an OCSP responder, this option also limits
112 the time that the responder is willing to wait for the client
113 request. This time is measured from the time the responder accepts
114 the connection until the complete request is received.
115
116 -multi process-count
117 Run the specified number of OCSP responder child processes, with
118 the parent process respawning child processes as needed. Child
119 processes will detect changes in the CA index file and
120 automatically reload it. When running as a responder -timeout
121 option is recommended to limit the time each child is willing to
122 wait for the client's OCSP response. This option is available on
123 POSIX systems (that support the fork() and other required unix
124 system-calls).
125
126 -CAfile file, -CApath pathname
127 File or pathname containing trusted CA certificates. These are used
128 to verify the signature on the OCSP response.
129
130 -no-CAfile
131 Do not load the trusted CA certificates from the default file
132 location
133
134 -no-CApath
135 Do not load the trusted CA certificates from the default directory
136 location
137
138 -attime, -check_ss_sig, -crl_check, -crl_check_all, -explicit_policy,
139 -extended_crl, -ignore_critical, -inhibit_any, -inhibit_map,
140 -no_alt_chains, -no_check_time, -partial_chain, -policy, -policy_check,
141 -policy_print, -purpose, -suiteB_128, -suiteB_128_only, -suiteB_192,
142 -trusted_first, -use_deltas, -auth_level, -verify_depth, -verify_email,
143 -verify_hostname, -verify_ip, -verify_name, -x509_strict
144 Set different certificate verification options. See verify(1)
145 manual page for details.
146
147 -verify_other file
148 File containing additional certificates to search when attempting
149 to locate the OCSP response signing certificate. Some responders
150 omit the actual signer's certificate from the response: this option
151 can be used to supply the necessary certificate in such cases.
152
153 -trust_other
154 The certificates specified by the -verify_other option should be
155 explicitly trusted and no additional checks will be performed on
156 them. This is useful when the complete responder certificate chain
157 is not available or trusting a root CA is not appropriate.
158
159 -VAfile file
160 File containing explicitly trusted responder certificates.
161 Equivalent to the -verify_other and -trust_other options.
162
163 -noverify
164 Don't attempt to verify the OCSP response signature or the nonce
165 values. This option will normally only be used for debugging since
166 it disables all verification of the responders certificate.
167
168 -no_intern
169 Ignore certificates contained in the OCSP response when searching
170 for the signers certificate. With this option the signers
171 certificate must be specified with either the -verify_other or
172 -VAfile options.
173
174 -no_signature_verify
175 Don't check the signature on the OCSP response. Since this option
176 tolerates invalid signatures on OCSP responses it will normally
177 only be used for testing purposes.
178
179 -no_cert_verify
180 Don't verify the OCSP response signers certificate at all. Since
181 this option allows the OCSP response to be signed by any
182 certificate it should only be used for testing purposes.
183
184 -no_chain
185 Do not use certificates in the response as additional untrusted CA
186 certificates.
187
188 -no_explicit
189 Do not explicitly trust the root CA if it is set to be trusted for
190 OCSP signing.
191
192 -no_cert_checks
193 Don't perform any additional checks on the OCSP response signers
194 certificate. That is do not make any checks to see if the signers
195 certificate is authorised to provide the necessary status
196 information: as a result this option should only be used for
197 testing purposes.
198
199 -validity_period nsec, -status_age age
200 These options specify the range of times, in seconds, which will be
201 tolerated in an OCSP response. Each certificate status response
202 includes a notBefore time and an optional notAfter time. The
203 current time should fall between these two values, but the interval
204 between the two times may be only a few seconds. In practice the
205 OCSP responder and clients clocks may not be precisely synchronised
206 and so such a check may fail. To avoid this the -validity_period
207 option can be used to specify an acceptable error range in seconds,
208 the default value is 5 minutes.
209
210 If the notAfter time is omitted from a response then this means
211 that new status information is immediately available. In this case
212 the age of the notBefore field is checked to see it is not older
213 than age seconds old. By default this additional check is not
214 performed.
215
216 -digest
217 This option sets digest algorithm to use for certificate
218 identification in the OCSP request. Any digest supported by the
219 OpenSSL dgst command can be used. The default is SHA-1. This
220 option may be used multiple times to specify the digest used by
221 subsequent certificate identifiers.
222
223 OCSP Server Options
224 -index indexfile
225 The indexfile parameter is the name of a text index file in ca
226 format containing certificate revocation information.
227
228 If the index option is specified the ocsp utility is in responder
229 mode, otherwise it is in client mode. The request(s) the responder
230 processes can be either specified on the command line (using issuer
231 and serial options), supplied in a file (using the reqin option) or
232 via external OCSP clients (if port or url is specified).
233
234 If the index option is present then the CA and rsigner options must
235 also be present.
236
237 -CA file
238 CA certificate corresponding to the revocation information in
239 indexfile.
240
241 -rsigner file
242 The certificate to sign OCSP responses with.
243
244 -rother file
245 Additional certificates to include in the OCSP response.
246
247 -resp_no_certs
248 Don't include any certificates in the OCSP response.
249
250 -resp_key_id
251 Identify the signer certificate using the key ID, default is to use
252 the subject name.
253
254 -rkey file
255 The private key to sign OCSP responses with: if not present the
256 file specified in the rsigner option is used.
257
258 -rsigopt nm:v
259 Pass options to the signature algorithm when signing OCSP
260 responses. Names and values of these options are algorithm-
261 specific.
262
263 -port portnum
264 Port to listen for OCSP requests on. The port may also be specified
265 using the url option.
266
267 -ignore_err
268 Ignore malformed requests or responses: When acting as an OCSP
269 client, retry if a malformed response is received. When acting as
270 an OCSP responder, continue running instead of terminating upon
271 receiving a malformed request.
272
273 -nrequest number
274 The OCSP server will exit after receiving number requests, default
275 unlimited.
276
277 -nmin minutes, -ndays days
278 Number of minutes or days when fresh revocation information is
279 available: used in the nextUpdate field. If neither option is
280 present then the nextUpdate field is omitted meaning fresh
281 revocation information is immediately available.
282
284 OCSP Response follows the rules specified in RFC2560.
285
286 Initially the OCSP responder certificate is located and the signature
287 on the OCSP request checked using the responder certificate's public
288 key.
289
290 Then a normal certificate verify is performed on the OCSP responder
291 certificate building up a certificate chain in the process. The
292 locations of the trusted certificates used to build the chain can be
293 specified by the CAfile and CApath options or they will be looked for
294 in the standard OpenSSL certificates directory.
295
296 If the initial verify fails then the OCSP verify process halts with an
297 error.
298
299 Otherwise the issuing CA certificate in the request is compared to the
300 OCSP responder certificate: if there is a match then the OCSP verify
301 succeeds.
302
303 Otherwise the OCSP responder certificate's CA is checked against the
304 issuing CA certificate in the request. If there is a match and the
305 OCSPSigning extended key usage is present in the OCSP responder
306 certificate then the OCSP verify succeeds.
307
308 Otherwise, if -no_explicit is not set the root CA of the OCSP
309 responders CA is checked to see if it is trusted for OCSP signing. If
310 it is the OCSP verify succeeds.
311
312 If none of these checks is successful then the OCSP verify fails.
313
314 What this effectively means if that if the OCSP responder certificate
315 is authorised directly by the CA it is issuing revocation information
316 about (and it is correctly configured) then verification will succeed.
317
318 If the OCSP responder is a "global responder" which can give details
319 about multiple CAs and has its own separate certificate chain then its
320 root CA can be trusted for OCSP signing. For example:
321
322 openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem
323
324 Alternatively the responder certificate itself can be explicitly
325 trusted with the -VAfile option.
326
328 As noted, most of the verify options are for testing or debugging
329 purposes. Normally only the -CApath, -CAfile and (if the responder is
330 a 'global VA') -VAfile options need to be used.
331
332 The OCSP server is only useful for test and demonstration purposes: it
333 is not really usable as a full OCSP responder. It contains only a very
334 simple HTTP request handling and can only handle the POST form of OCSP
335 queries. It also handles requests serially meaning it cannot respond to
336 new requests until it has processed the current one. The text index
337 file format of revocation is also inefficient for large quantities of
338 revocation data.
339
340 It is possible to run the ocsp application in responder mode via a CGI
341 script using the reqin and respout options.
342
344 Create an OCSP request and write it to a file:
345
346 openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der
347
348 Send a query to an OCSP responder with URL http://ocsp.myhost.com/ save
349 the response to a file, print it out in text form, and verify the
350 response:
351
352 openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \
353 -url http://ocsp.myhost.com/ -resp_text -respout resp.der
354
355 Read in an OCSP response and print out text form:
356
357 openssl ocsp -respin resp.der -text -noverify
358
359 OCSP server on port 8888 using a standard ca configuration, and a
360 separate responder certificate. All requests and responses are printed
361 to a file.
362
363 openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
364 -text -out log.txt
365
366 As above but exit after processing one request:
367
368 openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
369 -nrequest 1
370
371 Query status information using an internally generated request:
372
373 openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
374 -issuer demoCA/cacert.pem -serial 1
375
376 Query status information using request read from a file, and write the
377 response to a second file.
378
379 openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
380 -reqin req.der -respout resp.der
381
383 The -no_alt_chains option was added in OpenSSL 1.1.0.
384
386 Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
387
388 Licensed under the OpenSSL license (the "License"). You may not use
389 this file except in compliance with the License. You can obtain a copy
390 in the file LICENSE in the source distribution or at
391 <https://www.openssl.org/source/license.html>.
392
393
394
3951.1.1c 2019-05-28 OCSP(1)