1OCSP(1) OpenSSL OCSP(1)
2
3
4
6 ocsp - Online Certificate Status Protocol utility
7
9 openssl ocsp [-out file] [-issuer file] [-cert file] [-serial n]
10 [-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:n]
13 [-path] [-CApath dir] [-CAfile file] [-trusted_first] [-VAfile file]
14 [-validity_period n] [-status_age n] [-noverify] [-verify_other file]
15 [-trust_other] [-no_intern] [-no_signature_verify] [-no_cert_verify]
16 [-no_chain] [-no_cert_checks] [-port num] [-index file] [-CA file]
17 [-rsigner file] [-rkey file] [-rother file] [-resp_no_certs] [-nmin n]
18 [-ndays n] [-resp_key_id] [-nrequest n] [-md5|-sha1|...]
19
21 The Online Certificate Status Protocol (OCSP) enables applications to
22 determine the (revocation) state of an identified certificate (RFC
23 2560).
24
25 The ocsp command performs many common OCSP tasks. It can be used to
26 print out requests and responses, create requests and send queries to
27 an OCSP responder and behave like a mini OCSP server itself.
28
30 -out filename
31 specify output filename, default is standard output.
32
33 -issuer filename
34 This specifies the current issuer certificate. This option can be
35 used multiple times. The certificate specified in filename must be
36 in PEM format. This option MUST come before any -cert options.
37
38 -cert filename
39 Add the certificate filename to the request. The issuer certificate
40 is taken from the previous issuer option, or an error occurs if no
41 issuer certificate is specified.
42
43 -serial num
44 Same as the cert option except the certificate with serial number
45 num is added to the request. The serial number is interpreted as a
46 decimal integer unless preceded by 0x. Negative integers can also
47 be specified by preceding the value by a - sign.
48
49 -signer filename, -signkey filename
50 Sign the OCSP request using the certificate specified in the signer
51 option and the private key specified by the signkey option. If the
52 signkey option is not present then the private key is read from the
53 same file as the certificate. If neither option is specified then
54 the OCSP request is not signed.
55
56 -sign_other filename
57 Additional certificates to include in the signed request.
58
59 -nonce, -no_nonce
60 Add an OCSP nonce extension to a request or disable OCSP nonce
61 addition. Normally if an OCSP request is input using the respin
62 option no nonce is added: using the nonce option will force
63 addition of a nonce. If an OCSP request is being created (using
64 cert and serial options) a nonce is automatically added specifying
65 no_nonce overrides this.
66
67 -req_text, -resp_text, -text
68 print out the text form of the OCSP request, response or both
69 respectively.
70
71 -reqout file, -respout file
72 write out the DER encoded certificate request or response to file.
73
74 -reqin file, -respin file
75 read OCSP request or response file from file. These option are
76 ignored if OCSP request or response creation is implied by other
77 options (for example with serial, cert and host options).
78
79 -url responder_url
80 specify the responder URL. Both HTTP and HTTPS (SSL/TLS) URLs can
81 be specified.
82
83 -host hostname:port, -path pathname
84 if the host option is present then the OCSP request is sent to the
85 host hostname on port port. path specifies the HTTP path name to
86 use or "/" by default.
87
88 -CAfile file, -CApath pathname
89 file or pathname containing trusted CA certificates. These are used
90 to verify the signature on the OCSP response.
91
92 -trusted_first
93 Use certificates in CA file or CA directory over certificates
94 provided in the response or residing in other certificates file
95 when building the trust chain to verify responder certificate.
96 This is mainly useful in environments with Bridge CA or Cross-
97 Certified CAs.
98
99 -verify_other file
100 file containing additional certificates to search when attempting
101 to locate the OCSP response signing certificate. Some responders
102 omit the actual signer's certificate from the response: this option
103 can be used to supply the necessary certificate in such cases.
104
105 -trust_other
106 the certificates specified by the -verify_other option should be
107 explicitly trusted and no additional checks will be performed on
108 them. This is useful when the complete responder certificate chain
109 is not available or trusting a root CA is not appropriate.
110
111 -VAfile file
112 file containing explicitly trusted responder certificates.
113 Equivalent to the -verify_other and -trust_other options.
114
115 -noverify
116 don't attempt to verify the OCSP response signature or the nonce
117 values. This option will normally only be used for debugging since
118 it disables all verification of the responders certificate.
119
120 -no_intern
121 ignore certificates contained in the OCSP response when searching
122 for the signers certificate. With this option the signers
123 certificate must be specified with either the -verify_other or
124 -VAfile options.
125
126 -no_signature_verify
127 don't check the signature on the OCSP response. Since this option
128 tolerates invalid signatures on OCSP responses it will normally
129 only be used for testing purposes.
130
131 -no_cert_verify
132 don't verify the OCSP response signers certificate at all. Since
133 this option allows the OCSP response to be signed by any
134 certificate it should only be used for testing purposes.
135
136 -no_chain
137 do not use certificates in the response as additional untrusted CA
138 certificates.
139
140 -no_cert_checks
141 don't perform any additional checks on the OCSP response signers
142 certificate. That is do not make any checks to see if the signers
143 certificate is authorised to provide the necessary status
144 information: as a result this option should only be used for
145 testing purposes.
146
147 -validity_period nsec, -status_age age
148 these options specify the range of times, in seconds, which will be
149 tolerated in an OCSP response. Each certificate status response
150 includes a notBefore time and an optional notAfter time. The
151 current time should fall between these two values, but the interval
152 between the two times may be only a few seconds. In practice the
153 OCSP responder and clients clocks may not be precisely synchronised
154 and so such a check may fail. To avoid this the -validity_period
155 option can be used to specify an acceptable error range in seconds,
156 the default value is 5 minutes.
157
158 If the notAfter time is omitted from a response then this means
159 that new status information is immediately available. In this case
160 the age of the notBefore field is checked to see it is not older
161 than age seconds old. By default this additional check is not
162 performed.
163
164 -md5|-sha1|-sha256|-ripemod160|...
165 this option sets digest algorithm to use for certificate
166 identification in the OCSP request. By default SHA-1 is used. See
167 openssl dgst -h output for the list of available algorithms.
168
170 -index indexfile
171 indexfile is a text index file in ca format containing certificate
172 revocation information.
173
174 If the index option is specified the ocsp utility is in responder
175 mode, otherwise it is in client mode. The request(s) the responder
176 processes can be either specified on the command line (using issuer
177 and serial options), supplied in a file (using the respin option)
178 or via external OCSP clients (if port or url is specified).
179
180 If the index option is present then the CA and rsigner options must
181 also be present.
182
183 -CA file
184 CA certificate corresponding to the revocation information in
185 indexfile.
186
187 -rsigner file
188 The certificate to sign OCSP responses with.
189
190 -rother file
191 Additional certificates to include in the OCSP response.
192
193 -resp_no_certs
194 Don't include any certificates in the OCSP response.
195
196 -resp_key_id
197 Identify the signer certificate using the key ID, default is to use
198 the subject name.
199
200 -rkey file
201 The private key to sign OCSP responses with: if not present the
202 file specified in the rsigner option is used.
203
204 -port portnum
205 Port to listen for OCSP requests on. The port may also be specified
206 using the url option.
207
208 -nrequest number
209 The OCSP server will exit after receiving number requests, default
210 unlimited.
211
212 -nmin minutes, -ndays days
213 Number of minutes or days when fresh revocation information is
214 available: used in the nextUpdate field. If neither option is
215 present then the nextUpdate field is omitted meaning fresh
216 revocation information is immediately available.
217
219 OCSP Response follows the rules specified in RFC2560.
220
221 Initially the OCSP responder certificate is located and the signature
222 on the OCSP request checked using the responder certificate's public
223 key.
224
225 Then a normal certificate verify is performed on the OCSP responder
226 certificate building up a certificate chain in the process. The
227 locations of the trusted certificates used to build the chain can be
228 specified by the CAfile and CApath options or they will be looked for
229 in the standard OpenSSL certificates directory.
230
231 If the initial verify fails then the OCSP verify process halts with an
232 error.
233
234 Otherwise the issuing CA certificate in the request is compared to the
235 OCSP responder certificate: if there is a match then the OCSP verify
236 succeeds.
237
238 Otherwise the OCSP responder certificate's CA is checked against the
239 issuing CA certificate in the request. If there is a match and the
240 OCSPSigning extended key usage is present in the OCSP responder
241 certificate then the OCSP verify succeeds.
242
243 Otherwise the root CA of the OCSP responders CA is checked to see if it
244 is trusted for OCSP signing. If it is the OCSP verify succeeds.
245
246 If none of these checks is successful then the OCSP verify fails.
247
248 What this effectively means if that if the OCSP responder certificate
249 is authorised directly by the CA it is issuing revocation information
250 about (and it is correctly configured) then verification will succeed.
251
252 If the OCSP responder is a "global responder" which can give details
253 about multiple CAs and has its own separate certificate chain then its
254 root CA can be trusted for OCSP signing. For example:
255
256 openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem
257
258 Alternatively the responder certificate itself can be explicitly
259 trusted with the -VAfile option.
260
262 As noted, most of the verify options are for testing or debugging
263 purposes. Normally only the -CApath, -CAfile and (if the responder is
264 a 'global VA') -VAfile options need to be used.
265
266 The OCSP server is only useful for test and demonstration purposes: it
267 is not really usable as a full OCSP responder. It contains only a very
268 simple HTTP request handling and can only handle the POST form of OCSP
269 queries. It also handles requests serially meaning it cannot respond to
270 new requests until it has processed the current one. The text index
271 file format of revocation is also inefficient for large quantities of
272 revocation data.
273
274 It is possible to run the ocsp application in responder mode via a CGI
275 script using the respin and respout options.
276
278 Create an OCSP request and write it to a file:
279
280 openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der
281
282 Send a query to an OCSP responder with URL http://ocsp.myhost.com/ save
283 the response to a file and print it out in text form
284
285 openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \
286 -url http://ocsp.myhost.com/ -resp_text -respout resp.der
287
288 Read in an OCSP response and print out text form:
289
290 openssl ocsp -respin resp.der -text
291
292 OCSP server on port 8888 using a standard ca configuration, and a
293 separate responder certificate. All requests and responses are printed
294 to a file.
295
296 openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
297 -text -out log.txt
298
299 As above but exit after processing one request:
300
301 openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
302 -nrequest 1
303
304 Query status information using internally generated request:
305
306 openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
307 -issuer demoCA/cacert.pem -serial 1
308
309 Query status information using request read from a file, write response
310 to a second file.
311
312 openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
313 -reqin req.der -respout resp.der
314
315
316
3171.0.1e 2017-03-22 OCSP(1)