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] [-VAfile file] [-validity_period
14 n] [-status_age n] [-noverify] [-verify_other file] [-trust_other]
15 [-no_intern] [-no_signature_verify] [-no_cert_verify] [-no_chain]
16 [-no_cert_checks] [-port num] [-index file] [-CA file] [-rsigner file]
17 [-rkey file] [-rother file] [-resp_no_certs] [-nmin n] [-ndays n]
18 [-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 -verify_other file
93 file containing additional certificates to search when attempting
94 to locate the OCSP response signing certificate. Some responders
95 omit the actual signer's certificate from the response: this option
96 can be used to supply the necessary certificate in such cases.
97
98 -trust_other
99 the certificates specified by the -verify_other option should be
100 explicitly trusted and no additional checks will be performed on
101 them. This is useful when the complete responder certificate chain
102 is not available or trusting a root CA is not appropriate.
103
104 -VAfile file
105 file containing explicitly trusted responder certificates.
106 Equivalent to the -verify_other and -trust_other options.
107
108 -noverify
109 don't attempt to verify the OCSP response signature or the nonce
110 values. This option will normally only be used for debugging since
111 it disables all verification of the responders certificate.
112
113 -no_intern
114 ignore certificates contained in the OCSP response when searching
115 for the signers certificate. With this option the signers
116 certificate must be specified with either the -verify_other or
117 -VAfile options.
118
119 -no_signature_verify
120 don't check the signature on the OCSP response. Since this option
121 tolerates invalid signatures on OCSP responses it will normally
122 only be used for testing purposes.
123
124 -no_cert_verify
125 don't verify the OCSP response signers certificate at all. Since
126 this option allows the OCSP response to be signed by any
127 certificate it should only be used for testing purposes.
128
129 -no_chain
130 do not use certificates in the response as additional untrusted CA
131 certificates.
132
133 -no_cert_checks
134 don't perform any additional checks on the OCSP response signers
135 certificate. That is do not make any checks to see if the signers
136 certificate is authorised to provide the necessary status
137 information: as a result this option should only be used for
138 testing purposes.
139
140 -validity_period nsec, -status_age age
141 these options specify the range of times, in seconds, which will be
142 tolerated in an OCSP response. Each certificate status response
143 includes a notBefore time and an optional notAfter time. The
144 current time should fall between these two values, but the interval
145 between the two times may be only a few seconds. In practice the
146 OCSP responder and clients clocks may not be precisely synchronised
147 and so such a check may fail. To avoid this the -validity_period
148 option can be used to specify an acceptable error range in seconds,
149 the default value is 5 minutes.
150
151 If the notAfter time is omitted from a response then this means
152 that new status information is immediately available. In this case
153 the age of the notBefore field is checked to see it is not older
154 than age seconds old. By default this additional check is not
155 performed.
156
157 -md5|-sha1|-sha256|-ripemod160|...
158 this option sets digest algorithm to use for certificate
159 identification in the OCSP request. By default SHA-1 is used. See
160 openssl dgst -h output for the list of available algorithms.
161
163 -index indexfile
164 indexfile is a text index file in ca format containing certificate
165 revocation information.
166
167 If the index option is specified the ocsp utility is in responder
168 mode, otherwise it is in client mode. The request(s) the responder
169 processes can be either specified on the command line (using issuer
170 and serial options), supplied in a file (using the respin option)
171 or via external OCSP clients (if port or url is specified).
172
173 If the index option is present then the CA and rsigner options must
174 also be present.
175
176 -CA file
177 CA certificate corresponding to the revocation information in
178 indexfile.
179
180 -rsigner file
181 The certificate to sign OCSP responses with.
182
183 -rother file
184 Additional certificates to include in the OCSP response.
185
186 -resp_no_certs
187 Don't include any certificates in the OCSP response.
188
189 -resp_key_id
190 Identify the signer certificate using the key ID, default is to use
191 the subject name.
192
193 -rkey file
194 The private key to sign OCSP responses with: if not present the
195 file specified in the rsigner option is used.
196
197 -port portnum
198 Port to listen for OCSP requests on. The port may also be specified
199 using the url option.
200
201 -nrequest number
202 The OCSP server will exit after receiving number requests, default
203 unlimited.
204
205 -nmin minutes, -ndays days
206 Number of minutes or days when fresh revocation information is
207 available: used in the nextUpdate field. If neither option is
208 present then the nextUpdate field is omitted meaning fresh
209 revocation information is immediately available.
210
212 OCSP Response follows the rules specified in RFC2560.
213
214 Initially the OCSP responder certificate is located and the signature
215 on the OCSP request checked using the responder certificate's public
216 key.
217
218 Then a normal certificate verify is performed on the OCSP responder
219 certificate building up a certificate chain in the process. The
220 locations of the trusted certificates used to build the chain can be
221 specified by the CAfile and CApath options or they will be looked for
222 in the standard OpenSSL certificates directory.
223
224 If the initial verify fails then the OCSP verify process halts with an
225 error.
226
227 Otherwise the issuing CA certificate in the request is compared to the
228 OCSP responder certificate: if there is a match then the OCSP verify
229 succeeds.
230
231 Otherwise the OCSP responder certificate's CA is checked against the
232 issuing CA certificate in the request. If there is a match and the
233 OCSPSigning extended key usage is present in the OCSP responder
234 certificate then the OCSP verify succeeds.
235
236 Otherwise the root CA of the OCSP responders CA is checked to see if it
237 is trusted for OCSP signing. If it is the OCSP verify succeeds.
238
239 If none of these checks is successful then the OCSP verify fails.
240
241 What this effectively means if that if the OCSP responder certificate
242 is authorised directly by the CA it is issuing revocation information
243 about (and it is correctly configured) then verification will succeed.
244
245 If the OCSP responder is a "global responder" which can give details
246 about multiple CAs and has its own separate certificate chain then its
247 root CA can be trusted for OCSP signing. For example:
248
249 openssl x509 -in ocspCA.pem -addtrust OCSPSigning -out trustedCA.pem
250
251 Alternatively the responder certificate itself can be explicitly
252 trusted with the -VAfile option.
253
255 As noted, most of the verify options are for testing or debugging
256 purposes. Normally only the -CApath, -CAfile and (if the responder is
257 a 'global VA') -VAfile options need to be used.
258
259 The OCSP server is only useful for test and demonstration purposes: it
260 is not really usable as a full OCSP responder. It contains only a very
261 simple HTTP request handling and can only handle the POST form of OCSP
262 queries. It also handles requests serially meaning it cannot respond to
263 new requests until it has processed the current one. The text index
264 file format of revocation is also inefficient for large quantities of
265 revocation data.
266
267 It is possible to run the ocsp application in responder mode via a CGI
268 script using the respin and respout options.
269
271 Create an OCSP request and write it to a file:
272
273 openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem -reqout req.der
274
275 Send a query to an OCSP responder with URL http://ocsp.myhost.com/ save
276 the response to a file and print it out in text form
277
278 openssl ocsp -issuer issuer.pem -cert c1.pem -cert c2.pem \
279 -url http://ocsp.myhost.com/ -resp_text -respout resp.der
280
281 Read in an OCSP response and print out text form:
282
283 openssl ocsp -respin resp.der -text
284
285 OCSP server on port 8888 using a standard ca configuration, and a
286 separate responder certificate. All requests and responses are printed
287 to a file.
288
289 openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
290 -text -out log.txt
291
292 As above but exit after processing one request:
293
294 openssl ocsp -index demoCA/index.txt -port 8888 -rsigner rcert.pem -CA demoCA/cacert.pem
295 -nrequest 1
296
297 Query status information using internally generated request:
298
299 openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
300 -issuer demoCA/cacert.pem -serial 1
301
302 Query status information using request read from a file, write response
303 to a second file.
304
305 openssl ocsp -index demoCA/index.txt -rsigner rcert.pem -CA demoCA/cacert.pem
306 -reqin req.der -respout resp.der
307
308
309
3101.0.0e 2011-09-07 OCSP(1)