]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - secure/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3
Merge OpenSSL 1.0.2q.
[FreeBSD/FreeBSD.git] / secure / lib / libcrypto / man / X509_VERIFY_PARAM_set_flags.3
1 .\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
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 .if !\nF .nr F 0
58 .if \nF>0 \{\
59 .    de IX
60 .    tm Index:\\$1\t\\n%\t"\\$2"
61 ..
62 .    if !\nF==2 \{\
63 .        nr % 0
64 .        nr F 2
65 .    \}
66 .\}
67 .\"
68 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
70 .    \" fudge factors for nroff and troff
71 .if n \{\
72 .    ds #H 0
73 .    ds #V .8m
74 .    ds #F .3m
75 .    ds #[ \f1
76 .    ds #] \fP
77 .\}
78 .if t \{\
79 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80 .    ds #V .6m
81 .    ds #F 0
82 .    ds #[ \&
83 .    ds #] \&
84 .\}
85 .    \" simple accents for nroff and troff
86 .if n \{\
87 .    ds ' \&
88 .    ds ` \&
89 .    ds ^ \&
90 .    ds , \&
91 .    ds ~ ~
92 .    ds /
93 .\}
94 .if t \{\
95 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101 .\}
102 .    \" troff and (daisy-wheel) nroff accents
103 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110 .ds ae a\h'-(\w'a'u*4/10)'e
111 .ds Ae A\h'-(\w'A'u*4/10)'E
112 .    \" corrections for vroff
113 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115 .    \" for low resolution devices (crt and lpr)
116 .if \n(.H>23 .if \n(.V>19 \
117 \{\
118 .    ds : e
119 .    ds 8 ss
120 .    ds o a
121 .    ds d- d\h'-1'\(ga
122 .    ds D- D\h'-1'\(hy
123 .    ds th \o'bp'
124 .    ds Th \o'LP'
125 .    ds ae ae
126 .    ds Ae AE
127 .\}
128 .rm #[ #] #H #V #F C
129 .\" ========================================================================
130 .\"
131 .IX Title "X509_VERIFY_PARAM_set_flags 3"
132 .TH X509_VERIFY_PARAM_set_flags 3 "2018-11-20" "1.0.2q" "OpenSSL"
133 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
134 .\" way too many mistakes in technical documents.
135 .if n .ad l
136 .nh
137 .SH "NAME"
138 X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies, X509_VERIFY_PARAM_set1_host, X509_VERIFY_PARAM_add1_host, X509_VERIFY_PARAM_set_hostflags, X509_VERIFY_PARAM_get0_peername, X509_VERIFY_PARAM_set1_email, X509_VERIFY_PARAM_set1_ip, X509_VERIFY_PARAM_set1_ip_asc \- X509 verification parameters
139 .SH "SYNOPSIS"
140 .IX Header "SYNOPSIS"
141 .Vb 1
142 \& #include <openssl/x509_vfy.h>
143 \&
144 \& int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
145 \& int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
146 \&                                                        unsigned long flags);
147 \& unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
148 \&
149 \& int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
150 \& int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
151 \&
152 \& void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
153 \&
154 \& int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
155 \&                                                ASN1_OBJECT *policy);
156 \& int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, 
157 \&                                        STACK_OF(ASN1_OBJECT) *policies);
158 \&
159 \& void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
160 \& int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
161 \&
162 \& int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
163 \&                                 const char *name, size_t namelen);
164 \& int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
165 \&                                 const char *name, size_t namelen);
166 \& void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
167 \&                                      unsigned int flags);
168 \& char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param);
169 \& int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
170 \&                                 const char *email, size_t emaillen);
171 \& int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
172 \&                               const unsigned char *ip, size_t iplen);
173 \& int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc);
174 .Ve
175 .SH "DESCRIPTION"
176 .IX Header "DESCRIPTION"
177 These functions manipulate the \fBX509_VERIFY_PARAM\fR structure associated with
178 a certificate verification operation.
179 .PP
180 The \fIX509_VERIFY_PARAM_set_flags()\fR function sets the flags in \fBparam\fR by oring
181 it with \fBflags\fR. See the \fB\s-1VERIFICATION FLAGS\s0\fR section for a complete
182 description of values the \fBflags\fR parameter can take.
183 .PP
184 \&\fIX509_VERIFY_PARAM_get_flags()\fR returns the flags in \fBparam\fR.
185 .PP
186 \&\fIX509_VERIFY_PARAM_clear_flags()\fR clears the flags \fBflags\fR in \fBparam\fR.
187 .PP
188 \&\fIX509_VERIFY_PARAM_set_purpose()\fR sets the verification purpose in \fBparam\fR
189 to \fBpurpose\fR. This determines the acceptable purpose of the certificate
190 chain, for example \s-1SSL\s0 client or \s-1SSL\s0 server.
191 .PP
192 \&\fIX509_VERIFY_PARAM_set_trust()\fR sets the trust setting in \fBparam\fR to 
193 \&\fBtrust\fR.
194 .PP
195 \&\fIX509_VERIFY_PARAM_set_time()\fR sets the verification time in \fBparam\fR to
196 \&\fBt\fR. Normally the current time is used.
197 .PP
198 \&\fIX509_VERIFY_PARAM_add0_policy()\fR enables policy checking (it is disabled
199 by default) and adds \fBpolicy\fR to the acceptable policy set.
200 .PP
201 \&\fIX509_VERIFY_PARAM_set1_policies()\fR enables policy checking (it is disabled
202 by default) and sets the acceptable policy set to \fBpolicies\fR. Any existing
203 policy set is cleared. The \fBpolicies\fR parameter can be \fB\s-1NULL\s0\fR to clear
204 an existing policy set.
205 .PP
206 \&\fIX509_VERIFY_PARAM_set_depth()\fR sets the maximum verification depth to \fBdepth\fR.
207 That is the maximum number of untrusted \s-1CA\s0 certificates that can appear in a
208 chain.
209 .PP
210 \&\fIX509_VERIFY_PARAM_set1_host()\fR sets the expected \s-1DNS\s0 hostname to
211 \&\fBname\fR clearing any previously specified host name or names.  If
212 \&\fBname\fR is \s-1NULL,\s0 or empty the list of hostnames is cleared, and
213 name checks are not performed on the peer certificate.  If \fBname\fR
214 is NUL-terminated, \fBnamelen\fR may be zero, otherwise \fBnamelen\fR
215 must be set to the length of \fBname\fR.  When a hostname is specified,
216 certificate verification automatically invokes \fIX509_check_host\fR\|(3)
217 with flags equal to the \fBflags\fR argument given to
218 \&\fB\f(BIX509_VERIFY_PARAM_set_hostflags()\fB\fR (default zero).  Applications
219 are strongly advised to use this interface in preference to explicitly
220 calling \fIX509_check_host\fR\|(3), hostname checks are out of scope
221 with the \s-1\fIDANE\-EE\s0\fR\|(3) certificate usage, and the internal check will
222 be suppressed as appropriate when \s-1DANE\s0 support is added to OpenSSL.
223 .PP
224 \&\fIX509_VERIFY_PARAM_add1_host()\fR adds \fBname\fR as an additional reference
225 identifer that can match the peer's certificate.  Any previous names
226 set via \fIX509_VERIFY_PARAM_set1_host()\fR or \fIX509_VERIFY_PARAM_add1_host()\fR
227 are retained, no change is made if \fBname\fR is \s-1NULL\s0 or empty.  When
228 multiple names are configured, the peer is considered verified when
229 any name matches.
230 .PP
231 \&\fIX509_VERIFY_PARAM_get0_peername()\fR returns the \s-1DNS\s0 hostname or subject
232 CommonName from the peer certificate that matched one of the reference
233 identifiers.  When wildcard matching is not disabled, or when a
234 reference identifier specifies a parent domain (starts with \*(L".\*(R")
235 rather than a hostname, the peer name may be a wildcard name or a
236 sub-domain of the reference identifier respectively.  The return
237 string is allocated by the library and is no longer valid once the
238 associated \fBparam\fR argument is freed.  Applications must not free
239 the return value.
240 .PP
241 \&\fIX509_VERIFY_PARAM_set1_email()\fR sets the expected \s-1RFC822\s0 email address to
242 \&\fBemail\fR.  If \fBemail\fR is NUL-terminated, \fBemaillen\fR may be zero, otherwise
243 \&\fBemaillen\fR must be set to the length of \fBemail\fR.  When an email address
244 is specified, certificate verification automatically invokes
245 \&\fIX509_check_email\fR\|(3).
246 .PP
247 \&\fIX509_VERIFY_PARAM_set1_ip()\fR sets the expected \s-1IP\s0 address to \fBip\fR.
248 The \fBip\fR argument is in binary format, in network byte-order and
249 \&\fBiplen\fR must be set to 4 for IPv4 and 16 for IPv6.  When an \s-1IP\s0
250 address is specified, certificate verification automatically invokes
251 \&\fIX509_check_ip\fR\|(3).
252 .PP
253 \&\fIX509_VERIFY_PARAM_set1_ip_asc()\fR sets the expected \s-1IP\s0 address to
254 \&\fBipasc\fR.  The \fBipasc\fR argument is a NUL-terminal \s-1ASCII\s0 string:
255 dotted decimal quad for IPv4 and colon-separated hexadecimal for
256 IPv6.  The condensed \*(L"::\*(R" notation is supported for IPv6 addresses.
257 .SH "RETURN VALUES"
258 .IX Header "RETURN VALUES"
259 \&\fIX509_VERIFY_PARAM_set_flags()\fR, \fIX509_VERIFY_PARAM_clear_flags()\fR,
260 \&\fIX509_VERIFY_PARAM_set_purpose()\fR, \fIX509_VERIFY_PARAM_set_trust()\fR,
261 \&\fIX509_VERIFY_PARAM_add0_policy()\fR \fIX509_VERIFY_PARAM_set1_policies()\fR,
262 \&\fIX509_VERIFY_PARAM_set1_host()\fR, \fIX509_VERIFY_PARAM_set_hostflags()\fR,
263 \&\fIX509_VERIFY_PARAM_set1_email()\fR, \fIX509_VERIFY_PARAM_set1_ip()\fR and
264 \&\fIX509_VERIFY_PARAM_set1_ip_asc()\fR return 1 for success and 0 for
265 failure.
266 .PP
267 \&\fIX509_VERIFY_PARAM_get_flags()\fR returns the current verification flags.
268 .PP
269 \&\fIX509_VERIFY_PARAM_set_time()\fR and \fIX509_VERIFY_PARAM_set_depth()\fR do not return
270 values.
271 .PP
272 \&\fIX509_VERIFY_PARAM_get_depth()\fR returns the current verification depth.
273 .SH "VERIFICATION FLAGS"
274 .IX Header "VERIFICATION FLAGS"
275 The verification flags consists of zero or more of the following flags
276 ored together.
277 .PP
278 \&\fBX509_V_FLAG_CRL_CHECK\fR enables \s-1CRL\s0 checking for the certificate chain leaf
279 certificate. An error occurs if a suitable \s-1CRL\s0 cannot be found.
280 .PP
281 \&\fBX509_V_FLAG_CRL_CHECK_ALL\fR enables \s-1CRL\s0 checking for the entire certificate
282 chain.
283 .PP
284 \&\fBX509_V_FLAG_IGNORE_CRITICAL\fR disabled critical extension checking. By default
285 any unhandled critical extensions in certificates or (if checked) CRLs results
286 in a fatal error. If this flag is set unhandled critical extensions are
287 ignored. \fB\s-1WARNING\s0\fR setting this option for anything other than debugging
288 purposes can be a security risk. Finer control over which extensions are
289 supported can be performed in the verification callback.
290 .PP
291 THe \fBX509_V_FLAG_X509_STRICT\fR flag disables workarounds for some broken
292 certificates and makes the verification strictly apply \fBX509\fR rules.
293 .PP
294 \&\fBX509_V_FLAG_ALLOW_PROXY_CERTS\fR enables proxy certificate verification.
295 .PP
296 \&\fBX509_V_FLAG_POLICY_CHECK\fR enables certificate policy checking, by default
297 no policy checking is peformed. Additional information is sent to the 
298 verification callback relating to policy checking.
299 .PP
300 \&\fBX509_V_FLAG_EXPLICIT_POLICY\fR, \fBX509_V_FLAG_INHIBIT_ANY\fR and
301 \&\fBX509_V_FLAG_INHIBIT_MAP\fR set the \fBrequire explicit policy\fR, \fBinhibit any
302 policy\fR and \fBinhibit policy mapping\fR flags respectively as defined in
303 \&\fB\s-1RFC3280\s0\fR. Policy checking is automatically enabled if any of these flags
304 are set.
305 .PP
306 If \fBX509_V_FLAG_NOTIFY_POLICY\fR is set and the policy checking is successful
307 a special status code is set to the verification callback. This permits it
308 to examine the valid policy tree and perform additional checks or simply
309 log it for debugging purposes.
310 .PP
311 By default some additional features such as indirect CRLs and CRLs signed by
312 different keys are disabled. If \fBX509_V_FLAG_EXTENDED_CRL_SUPPORT\fR is set
313 they are enabled.
314 .PP
315 If \fBX509_V_FLAG_USE_DELTAS\fR ise set delta CRLs (if present) are used to
316 determine certificate status. If not set deltas are ignored.
317 .PP
318 \&\fBX509_V_FLAG_CHECK_SS_SIGNATURE\fR enables checking of the root \s-1CA\s0 self signed
319 cerificate signature. By default this check is disabled because it doesn't
320 add any additional security but in some cases applications might want to
321 check the signature anyway. A side effect of not checking the root \s-1CA\s0
322 signature is that disabled or unsupported message digests on the root \s-1CA\s0
323 are not treated as fatal errors.
324 .PP
325 The \fBX509_V_FLAG_CB_ISSUER_CHECK\fR flag enables debugging of certificate
326 issuer checks. It is \fBnot\fR needed unless you are logging certificate
327 verification. If this flag is set then additional status codes will be sent
328 to the verification callback and it \fBmust\fR be prepared to handle such cases
329 without assuming they are hard errors.
330 .PP
331 The \fBX509_V_FLAG_NO_ALT_CHAINS\fR flag suppresses checking for alternative
332 chains. By default, when building a certificate chain, if the first certificate
333 chain found is not trusted, then OpenSSL will continue to check to see if an
334 alternative chain can be found that is trusted. With this flag set the behaviour
335 will match that of OpenSSL versions prior to 1.0.2b.
336 .PP
337 The \fBX509_V_FLAG_TRUSTED_FIRST\fR flag causes chain construction to look for
338 issuers in the trust store before looking at the untrusted certificates
339 provided as part of the the peer chain.
340 Though it is not on by default in OpenSSL 1.0.2, applications should generally
341 set this flag.
342 Local issuer certificates are often more likely to satisfy local security
343 requirements and lead to a locally trusted root.
344 This is especially important When some certificates in the trust store have
345 explicit trust settings (see \*(L"\s-1TRUST SETTINGS\*(R"\s0 in \fIx509\fR\|(1)).
346 .PP
347 The \fBX509_V_FLAG_PARTIAL_CHAIN\fR flag causes intermediate certificates in the
348 trust store to be treated as trust-anchors, in the same way as the self-signed
349 root \s-1CA\s0 certificates.
350 This makes it possible to trust certificates issued by an intermediate \s-1CA\s0
351 without having to trust its ancestor root \s-1CA.\s0
352 With OpenSSL 1.0.2, chain construction continues as long as there are
353 additional trusted issuers in the trust store, and the last trusted issuer
354 becomes the trust-anchor.
355 Thus, even when an intermediate certificate is found in the trust store, the
356 verified chain passed to callbacks may still be anchored by a root \s-1CA.\s0
357 .SH "NOTES"
358 .IX Header "NOTES"
359 The above functions should be used to manipulate verification parameters
360 instead of legacy functions which work in specific structures such as
361 \&\fIX509_STORE_CTX_set_flags()\fR.
362 .SH "BUGS"
363 .IX Header "BUGS"
364 Delta \s-1CRL\s0 checking is currently primitive. Only a single delta can be used and
365 (partly due to limitations of \fBX509_STORE\fR) constructed CRLs are not 
366 maintained.
367 .PP
368 If CRLs checking is enable CRLs are expected to be available in the
369 corresponding \fBX509_STORE\fR structure. No attempt is made to download
370 CRLs from the \s-1CRL\s0 distribution points extension.
371 .SH "EXAMPLE"
372 .IX Header "EXAMPLE"
373 Enable \s-1CRL\s0 checking when performing certificate verification during \s-1SSL\s0 
374 connections associated with an \fB\s-1SSL_CTX\s0\fR structure \fBctx\fR:
375 .PP
376 .Vb 5
377 \&  X509_VERIFY_PARAM *param;
378 \&  param = X509_VERIFY_PARAM_new();
379 \&  X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);
380 \&  SSL_CTX_set1_param(ctx, param);
381 \&  X509_VERIFY_PARAM_free(param);
382 .Ve
383 .SH "SEE ALSO"
384 .IX Header "SEE ALSO"
385 \&\fIX509_verify_cert\fR\|(3),
386 \&\fIX509_check_host\fR\|(3),
387 \&\fIX509_check_email\fR\|(3),
388 \&\fIX509_check_ip\fR\|(3),
389 \&\fIx509\fR\|(1)
390 .SH "HISTORY"
391 .IX Header "HISTORY"
392 The \fBX509_V_FLAG_NO_ALT_CHAINS\fR flag was added in OpenSSL 1.0.2b