1 .\" $OpenBSD: OCSP_resp_find_status.3,v 1.5 2016/12/25 22:15:10 schwarze Exp $
2 .\" OpenSSL c952780c Jun 21 07:03:34 2016 -0400
4 .\" This file is a derived work.
5 .\" The changes are covered by the following Copyright and license:
7 .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
9 .\" Permission to use, copy, modify, and distribute this software for any
10 .\" purpose with or without fee is hereby granted, provided that the above
11 .\" copyright notice and this permission notice appear in all copies.
13 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
22 .\" Copyright (c) 2014 The OpenSSL Project. All rights reserved.
24 .\" Redistribution and use in source and binary forms, with or without
25 .\" modification, are permitted provided that the following conditions
28 .\" 1. Redistributions of source code must retain the above copyright
29 .\" notice, this list of conditions and the following disclaimer.
31 .\" 2. Redistributions in binary form must reproduce the above copyright
32 .\" notice, this list of conditions and the following disclaimer in
33 .\" the documentation and/or other materials provided with the
36 .\" 3. All advertising materials mentioning features or use of this
37 .\" software must display the following acknowledgment:
38 .\" "This product includes software developed by the OpenSSL Project
39 .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
41 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42 .\" endorse or promote products derived from this software without
43 .\" prior written permission. For written permission, please contact
44 .\" openssl-core@openssl.org.
46 .\" 5. Products derived from this software may not be called "OpenSSL"
47 .\" nor may "OpenSSL" appear in their names without prior written
48 .\" permission of the OpenSSL Project.
50 .\" 6. Redistributions of any form whatsoever must retain the following
52 .\" "This product includes software developed by the OpenSSL Project
53 .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
55 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
68 .Dd $Mdocdate: December 25 2016 $
69 .Dt OCSP_RESP_FIND_STATUS 3
72 .Nm OCSP_SINGLERESP_new ,
73 .Nm OCSP_SINGLERESP_free ,
74 .Nm OCSP_CERTSTATUS_new ,
75 .Nm OCSP_CERTSTATUS_free ,
76 .Nm OCSP_REVOKEDINFO_new ,
77 .Nm OCSP_REVOKEDINFO_free ,
78 .Nm OCSP_resp_find_status ,
82 .Nm OCSP_single_get0_status ,
83 .Nm OCSP_check_validity
84 .Nd OCSP response utility functions
88 .Fn OCSP_SINGLERESP_new void
90 .Fn OCSP_SINGLERESP_free "OCSP_SINGLERESP *single"
92 .Fn OCSP_CERTSTATUS_new void
94 .Fn OCSP_CERTSTATUS_free "OCSP_CERTSTATUS *certstatus"
95 .Ft OCSP_REVOKEDINFO *
96 .Fn OCSP_REVOKEDINFO_new void
98 .Fn OCSP_REVOKEDINFO_free "OCSP_REVOKEDINFO *revokedinfo"
100 .Fo OCSP_resp_find_status
101 .Fa "OCSP_BASICRESP *bs"
102 .Fa "OCSP_CERTID *id"
105 .Fa "ASN1_GENERALIZEDTIME **revtime"
106 .Fa "ASN1_GENERALIZEDTIME **thisupd"
107 .Fa "ASN1_GENERALIZEDTIME **nextupd"
111 .Fa "OCSP_BASICRESP *bs"
113 .Ft OCSP_SINGLERESP *
115 .Fa "OCSP_BASICRESP *bs"
120 .Fa "OCSP_BASICRESP *bs"
121 .Fa "OCSP_CERTID *id"
125 .Fo OCSP_single_get0_status
126 .Fa "OCSP_SINGLERESP *single"
128 .Fa "ASN1_GENERALIZEDTIME **revtime"
129 .Fa "ASN1_GENERALIZEDTIME **thisupd"
130 .Fa "ASN1_GENERALIZEDTIME **nextupd"
133 .Fo OCSP_check_validity
134 .Fa "ASN1_GENERALIZEDTIME *thisupd"
135 .Fa "ASN1_GENERALIZEDTIME *nextupd"
140 .Fn OCSP_SINGLERESP_new
141 allocates and initializes an empty
143 object, representing an ASN.1
145 structure defined in RFC 6960.
146 Each such object can store the server's answer regarding the validity
147 of one individual certificate.
148 Such objects are used inside the
152 objects, which are described in
153 .Xr OCSP_BASICRESP_new 3 .
154 .Fn OCSP_SINGLERESP_free
158 .Fn OCSP_CERTSTATUS_new
159 allocates and initializes an empty
161 object, representing an ASN.1
163 structure defined in RFC 6960.
164 Such an object is used inside
165 .Vt OCSP_SINGLERESP .
166 .Fn OCSP_CERTSTATUS_free
170 .Fn OCSP_REVOKEDINFO_new
171 allocates and initializes an empty
173 object, representing an ASN.1
175 structure defined in RFC 6960.
176 Such an object is used inside
177 .Vt OCSP_CERTSTATUS .
178 .Fn OCSP_REVOKEDINFO_free
182 .Fn OCSP_resp_find_status
185 for an OCSP response for
187 If it is successful, the fields of the response are returned in
197 .Dv V_OCSP_CERTSTATUS_GOOD ,
198 .Dv V_OCSP_CERTSTATUS_REVOKED ,
200 .Dv V_OCSP_CERTSTATUS_UNKNOWN .
205 fields are only set if the status is
206 .Dv V_OCSP_CERTSTATUS_REVOKED .
209 field will be set to the revocation reason which will be one of
210 .Dv OCSP_REVOKED_STATUS_NOSTATUS ,
211 .Dv OCSP_REVOKED_STATUS_UNSPECIFIED ,
212 .Dv OCSP_REVOKED_STATUS_KEYCOMPROMISE ,
213 .Dv OCSP_REVOKED_STATUS_CACOMPROMISE ,
214 .Dv OCSP_REVOKED_STATUS_AFFILIATIONCHANGED ,
215 .Dv OCSP_REVOKED_STATUS_SUPERSEDED ,
216 .Dv OCSP_REVOKED_STATUS_CESSATIONOFOPERATION ,
217 .Dv OCSP_REVOKED_STATUS_CERTIFICATEHOLD
219 .Dv OCSP_REVOKED_STATUS_REMOVEFROMCRL .
222 returns the number of
232 corresponding to index
237 .Fn OCSP_resp_count bs No - 1 .
244 and returns the index of the first matching entry after
246 or starting from the beginning if
250 .Fn OCSP_single_get0_status
251 extracts the fields of
260 .Fn OCSP_check_validity
261 checks the validity of
265 values which will be typically obtained from
266 .Fn OCSP_resp_find_status
268 .Fn OCSP_single_get0_status .
271 is non-zero it indicates how many seconds leeway should be allowed in
275 is positive it indicates the maximum age of
279 Applications will typically call
280 .Fn OCSP_resp_find_status
281 using the certificate ID of interest and then check its validity using
282 .Fn OCSP_check_validity .
283 They can then take appropriate action based on the status of the
286 An OCSP response for a certificate contains
291 Normally the current time should be between these two values.
292 To account for clock skew, the
294 field can be set to non-zero in
295 .Fn OCSP_check_validity .
296 Some responders do not set the
299 This would otherwise mean an ancient response would be considered
303 .Fn OCSP_check_validity
304 can be used to limit the permitted age of responses.
306 The values written to
312 .Fn OCSP_resp_find_status
314 .Fn OCSP_single_get0_status
315 are internal pointers which must not be freed up by the calling
317 Any or all of these parameters can be set to
319 if their value is not required.
321 .Fn OCSP_SINGLERESP_new ,
322 .Fn OCSP_CERTSTATUS_new ,
324 .Fn OCSP_REVOKEDINFO_new
325 return a pointer to an empty
326 .Vt OCSP_SINGLERESP ,
327 .Vt OCSP_CERTSTATUS ,
330 object, respectively, or
332 if an error occurred.
334 .Fn OCSP_resp_find_status
342 returns the total number of
348 returns a pointer to an
361 (which may be 0) or -1 if
365 .Fn OCSP_single_get0_status
366 returns the status of
368 or -1 if an error occurred.
370 .Xr OCSP_cert_to_id 3 ,
371 .Xr OCSP_CRLID_new 3 ,
372 .Xr OCSP_request_add1_nonce 3 ,
373 .Xr OCSP_REQUEST_new 3 ,
374 .Xr OCSP_response_status 3 ,
375 .Xr OCSP_sendreq_new 3
377 RFC 6960: X.509 Internet Public Key Infrastructure Online Certificate
378 Status Protocol, section 4.2: Response Syntax