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