]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/man3/OCSP_resp_find_status.3
MFS: r366176
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / man3 / OCSP_resp_find_status.3
1 .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is >0, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{\
60 .    if \nF \{\
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{\
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "OCSP_RESP_FIND_STATUS 3"
136 .TH OCSP_RESP_FIND_STATUS 3 "2020-09-22" "1.1.1h" "OpenSSL"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 OCSP_resp_get0_certs, OCSP_resp_get0_signer, OCSP_resp_get0_id, OCSP_resp_get1_id, OCSP_resp_get0_produced_at, OCSP_resp_get0_signature, OCSP_resp_get0_tbs_sigalg, OCSP_resp_get0_respdata, OCSP_resp_find_status, OCSP_resp_count, OCSP_resp_get0, OCSP_resp_find, OCSP_single_get0_status, OCSP_check_validity, OCSP_basic_verify \&\- OCSP response utility functions
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 1
146 \& #include <openssl/ocsp.h>
147 \&
148 \& int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
149 \&                           int *reason,
150 \&                           ASN1_GENERALIZEDTIME **revtime,
151 \&                           ASN1_GENERALIZEDTIME **thisupd,
152 \&                           ASN1_GENERALIZEDTIME **nextupd);
153 \&
154 \& int OCSP_resp_count(OCSP_BASICRESP *bs);
155 \& OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
156 \& int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
157 \& int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
158 \&                             ASN1_GENERALIZEDTIME **revtime,
159 \&                             ASN1_GENERALIZEDTIME **thisupd,
160 \&                             ASN1_GENERALIZEDTIME **nextupd);
161 \&
162 \& const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(
163 \&                             const OCSP_BASICRESP* single);
164 \&
165 \& const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs);
166 \& const X509_ALGOR *OCSP_resp_get0_tbs_sigalg(const OCSP_BASICRESP *bs);
167 \& const OCSP_RESPDATA *OCSP_resp_get0_respdata(const OCSP_BASICRESP *bs);
168 \& const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);
169 \&
170 \& int OCSP_resp_get0_signer(OCSP_BASICRESP *bs, X509 **signer,
171 \&                           STACK_OF(X509) *extra_certs);
172 \&
173 \& int OCSP_resp_get0_id(const OCSP_BASICRESP *bs,
174 \&                       const ASN1_OCTET_STRING **pid,
175 \&                       const X509_NAME **pname);
176 \& int OCSP_resp_get1_id(const OCSP_BASICRESP *bs,
177 \&                       ASN1_OCTET_STRING **pid,
178 \&                       X509_NAME **pname);
179 \&
180 \& int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,
181 \&                         ASN1_GENERALIZEDTIME *nextupd,
182 \&                         long sec, long maxsec);
183 \&
184 \& int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
185 \&                      X509_STORE *st, unsigned long flags);
186 .Ve
187 .SH "DESCRIPTION"
188 .IX Header "DESCRIPTION"
189 \&\fBOCSP_resp_find_status()\fR searches \fBbs\fR for an \s-1OCSP\s0 response for \fBid\fR. If it is
190 successful the fields of the response are returned in \fB*status\fR, \fB*reason\fR,
191 \&\fB*revtime\fR, \fB*thisupd\fR and \fB*nextupd\fR.  The \fB*status\fR value will be one of
192 \&\fBV_OCSP_CERTSTATUS_GOOD\fR, \fBV_OCSP_CERTSTATUS_REVOKED\fR or
193 \&\fBV_OCSP_CERTSTATUS_UNKNOWN\fR. The \fB*reason\fR and \fB*revtime\fR fields are only
194 set if the status is \fBV_OCSP_CERTSTATUS_REVOKED\fR. If set the \fB*reason\fR field
195 will be set to the revocation reason which will be one of
196 \&\fB\s-1OCSP_REVOKED_STATUS_NOSTATUS\s0\fR, \fB\s-1OCSP_REVOKED_STATUS_UNSPECIFIED\s0\fR,
197 \&\fB\s-1OCSP_REVOKED_STATUS_KEYCOMPROMISE\s0\fR, \fB\s-1OCSP_REVOKED_STATUS_CACOMPROMISE\s0\fR,
198 \&\fB\s-1OCSP_REVOKED_STATUS_AFFILIATIONCHANGED\s0\fR, \fB\s-1OCSP_REVOKED_STATUS_SUPERSEDED\s0\fR,
199 \&\fB\s-1OCSP_REVOKED_STATUS_CESSATIONOFOPERATION\s0\fR,
200 \&\fB\s-1OCSP_REVOKED_STATUS_CERTIFICATEHOLD\s0\fR or \fB\s-1OCSP_REVOKED_STATUS_REMOVEFROMCRL\s0\fR.
201 .PP
202 \&\fBOCSP_resp_count()\fR returns the number of \fB\s-1OCSP_SINGLERESP\s0\fR structures in \fBbs\fR.
203 .PP
204 \&\fBOCSP_resp_get0()\fR returns the \fB\s-1OCSP_SINGLERESP\s0\fR structure in \fBbs\fR
205 corresponding to index \fBidx\fR. Where \fBidx\fR runs from 0 to
206 OCSP_resp_count(bs) \- 1.
207 .PP
208 \&\fBOCSP_resp_find()\fR searches \fBbs\fR for \fBid\fR and returns the index of the first
209 matching entry after \fBlast\fR or starting from the beginning if \fBlast\fR is \-1.
210 .PP
211 \&\fBOCSP_single_get0_status()\fR extracts the fields of \fBsingle\fR in \fB*reason\fR,
212 \&\fB*revtime\fR, \fB*thisupd\fR and \fB*nextupd\fR.
213 .PP
214 \&\fBOCSP_resp_get0_produced_at()\fR extracts the \fBproducedAt\fR field from the
215 single response \fBbs\fR.
216 .PP
217 \&\fBOCSP_resp_get0_signature()\fR returns the signature from \fBbs\fR.
218 .PP
219 \&\fBOCSP_resp_get0_tbs_sigalg()\fR returns the \fBsignatureAlgorithm\fR from \fBbs\fR.
220 .PP
221 \&\fBOCSP_resp_get0_respdata()\fR returns the \fBtbsResponseData\fR from \fBbs\fR.
222 .PP
223 \&\fBOCSP_resp_get0_certs()\fR returns any certificates included in \fBbs\fR.
224 .PP
225 \&\fBOCSP_resp_get0_signer()\fR attempts to retrieve the certificate that directly
226 signed \fBbs\fR.  The \s-1OCSP\s0 protocol does not require that this certificate
227 is included in the \fBcerts\fR field of the response, so additional certificates
228 can be supplied in \fBextra_certs\fR if the certificates that may have
229 signed the response are known via some out-of-band mechanism.
230 .PP
231 \&\fBOCSP_resp_get0_id()\fR gets the responder id of \fBbs\fR. If the responder \s-1ID\s0 is
232 a name then <*pname> is set to the name and \fB*pid\fR is set to \s-1NULL.\s0 If the
233 responder \s-1ID\s0 is by key \s-1ID\s0 then \fB*pid\fR is set to the key \s-1ID\s0 and \fB*pname\fR
234 is set to \s-1NULL.\s0 \fBOCSP_resp_get1_id()\fR leaves ownership of \fB*pid\fR and \fB*pname\fR
235 with the caller, who is responsible for freeing them. Both functions return 1
236 in case of success and 0 in case of failure. If \fBOCSP_resp_get1_id()\fR returns 0,
237 no freeing of the results is necessary.
238 .PP
239 \&\fBOCSP_check_validity()\fR checks the validity of \fBthisupd\fR and \fBnextupd\fR values
240 which will be typically obtained from \fBOCSP_resp_find_status()\fR or
241 \&\fBOCSP_single_get0_status()\fR. If \fBsec\fR is nonzero it indicates how many seconds
242 leeway should be allowed in the check. If \fBmaxsec\fR is positive it indicates
243 the maximum age of \fBthisupd\fR in seconds.
244 .PP
245 \&\fBOCSP_basic_verify()\fR checks that the basic response message \fBbs\fR is correctly
246 signed and that the signer certificate can be validated. It takes \fBst\fR as
247 the trusted store and \fBcerts\fR as a set of untrusted intermediate certificates.
248 The function first tries to find the signer certificate of the response
249 in <certs>. It also searches the certificates the responder may have included
250 in \fBbs\fR unless the \fBflags\fR contain \fB\s-1OCSP_NOINTERN\s0\fR.
251 It fails if the signer certificate cannot be found.
252 Next, the function checks the signature of \fBbs\fR and fails on error
253 unless the \fBflags\fR contain \fB\s-1OCSP_NOSIGS\s0\fR. Then the function already returns
254 success if the \fBflags\fR contain \fB\s-1OCSP_NOVERIFY\s0\fR or if the signer certificate
255 was found in \fBcerts\fR and the \fBflags\fR contain \fB\s-1OCSP_TRUSTOTHER\s0\fR.
256 Otherwise the function continues by validating the signer certificate.
257 To this end, all certificates in \fBcert\fR and in \fBbs\fR are considered as
258 untrusted certificates for the construction of the validation path for the
259 signer certificate unless the \fB\s-1OCSP_NOCHAIN\s0\fR flag is set. After successful path
260 validation the function returns success if the \fB\s-1OCSP_NOCHECKS\s0\fR flag is set.
261 Otherwise it verifies that the signer certificate meets the \s-1OCSP\s0 issuer
262 criteria including potential delegation. If this does not succeed and the
263 \&\fBflags\fR do not contain \fB\s-1OCSP_NOEXPLICIT\s0\fR the function checks for explicit
264 trust for \s-1OCSP\s0 signing in the root \s-1CA\s0 certificate.
265 .SH "RETURN VALUES"
266 .IX Header "RETURN VALUES"
267 \&\fBOCSP_resp_find_status()\fR returns 1 if \fBid\fR is found in \fBbs\fR and 0 otherwise.
268 .PP
269 \&\fBOCSP_resp_count()\fR returns the total number of \fB\s-1OCSP_SINGLERESP\s0\fR fields in
270 \&\fBbs\fR.
271 .PP
272 \&\fBOCSP_resp_get0()\fR returns a pointer to an \fB\s-1OCSP_SINGLERESP\s0\fR structure or
273 \&\fB\s-1NULL\s0\fR if \fBidx\fR is out of range.
274 .PP
275 \&\fBOCSP_resp_find()\fR returns the index of \fBid\fR in \fBbs\fR (which may be 0) or \-1 if
276 \&\fBid\fR was not found.
277 .PP
278 \&\fBOCSP_single_get0_status()\fR returns the status of \fBsingle\fR or \-1 if an error
279 occurred.
280 .PP
281 \&\fBOCSP_resp_get0_signer()\fR returns 1 if the signing certificate was located,
282 or 0 on error.
283 .PP
284 \&\fBOCSP_basic_verify()\fR returns 1 on success, 0 on error, or \-1 on fatal error such
285 as malloc failure.
286 .SH "NOTES"
287 .IX Header "NOTES"
288 Applications will typically call \fBOCSP_resp_find_status()\fR using the certificate
289 \&\s-1ID\s0 of interest and then check its validity using \fBOCSP_check_validity()\fR. They
290 can then take appropriate action based on the status of the certificate.
291 .PP
292 An \s-1OCSP\s0 response for a certificate contains \fBthisUpdate\fR and \fBnextUpdate\fR
293 fields. Normally the current time should be between these two values. To
294 account for clock skew the \fBmaxsec\fR field can be set to nonzero in
295 \&\fBOCSP_check_validity()\fR. Some responders do not set the \fBnextUpdate\fR field, this
296 would otherwise mean an ancient response would be considered valid: the
297 \&\fBmaxsec\fR parameter to \fBOCSP_check_validity()\fR can be used to limit the permitted
298 age of responses.
299 .PP
300 The values written to \fB*revtime\fR, \fB*thisupd\fR and \fB*nextupd\fR by
301 \&\fBOCSP_resp_find_status()\fR and \fBOCSP_single_get0_status()\fR are internal pointers
302 which \fB\s-1MUST NOT\s0\fR be freed up by the calling application. Any or all of these
303 parameters can be set to \s-1NULL\s0 if their value is not required.
304 .SH "SEE ALSO"
305 .IX Header "SEE ALSO"
306 \&\fBcrypto\fR\|(7),
307 \&\fBOCSP_cert_to_id\fR\|(3),
308 \&\fBOCSP_request_add1_nonce\fR\|(3),
309 \&\fBOCSP_REQUEST_new\fR\|(3),
310 \&\fBOCSP_response_status\fR\|(3),
311 \&\fBOCSP_sendreq_new\fR\|(3)
312 .SH "COPYRIGHT"
313 .IX Header "COPYRIGHT"
314 Copyright 2015\-2020 The OpenSSL Project Authors. All Rights Reserved.
315 .PP
316 Licensed under the OpenSSL license (the \*(L"License\*(R").  You may not use
317 this file except in compliance with the License.  You can obtain a copy
318 in the file \s-1LICENSE\s0 in the source distribution or at
319 <https://www.openssl.org/source/license.html>.