Update files for OpenSSL-1.0.2h import.
[dragonfly.git] / secure / lib / libcrypto / man / X509_VERIFY_PARAM_set_flags.3
1 .\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28)
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 turned on, 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 "X509_VERIFY_PARAM_set_flags 3"
136 .TH X509_VERIFY_PARAM_set_flags 3 "2016-05-03" "1.0.2h" "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 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
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 1
146 \& #include <openssl/x509_vfy.h>
147 \&
148 \& int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
149 \& int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
150 \&                                                        unsigned long flags);
151 \& unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
152 \&
153 \& int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
154 \& int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
155 \&
156 \& void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
157 \&
158 \& int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
159 \&                                                ASN1_OBJECT *policy);
160 \& int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, 
161 \&                                        STACK_OF(ASN1_OBJECT) *policies);
162 \&
163 \& void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
164 \& int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
165 \&
166 \& int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
167 \&                                 const char *name, size_t namelen);
168 \& int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
169 \&                                 const char *name, size_t namelen);
170 \& void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
171 \&                                      unsigned int flags);
172 \& char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *param);
173 \& int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
174 \&                                 const char *email, size_t emaillen);
175 \& int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
176 \&                               const unsigned char *ip, size_t iplen);
177 \& int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc);
178 .Ve
179 .SH "DESCRIPTION"
180 .IX Header "DESCRIPTION"
181 These functions manipulate the \fBX509_VERIFY_PARAM\fR structure associated with
182 a certificate verification operation.
183 .PP
184 The \fIX509_VERIFY_PARAM_set_flags()\fR function sets the flags in \fBparam\fR by oring
185 it with \fBflags\fR. See the \fB\s-1VERIFICATION FLAGS\s0\fR section for a complete
186 description of values the \fBflags\fR parameter can take.
187 .PP
188 \&\fIX509_VERIFY_PARAM_get_flags()\fR returns the flags in \fBparam\fR.
189 .PP
190 \&\fIX509_VERIFY_PARAM_clear_flags()\fR clears the flags \fBflags\fR in \fBparam\fR.
191 .PP
192 \&\fIX509_VERIFY_PARAM_set_purpose()\fR sets the verification purpose in \fBparam\fR
193 to \fBpurpose\fR. This determines the acceptable purpose of the certificate
194 chain, for example \s-1SSL\s0 client or \s-1SSL\s0 server.
195 .PP
196 \&\fIX509_VERIFY_PARAM_set_trust()\fR sets the trust setting in \fBparam\fR to 
197 \&\fBtrust\fR.
198 .PP
199 \&\fIX509_VERIFY_PARAM_set_time()\fR sets the verification time in \fBparam\fR to
200 \&\fBt\fR. Normally the current time is used.
201 .PP
202 \&\fIX509_VERIFY_PARAM_add0_policy()\fR enables policy checking (it is disabled
203 by default) and adds \fBpolicy\fR to the acceptable policy set.
204 .PP
205 \&\fIX509_VERIFY_PARAM_set1_policies()\fR enables policy checking (it is disabled
206 by default) and sets the acceptable policy set to \fBpolicies\fR. Any existing
207 policy set is cleared. The \fBpolicies\fR parameter can be \fB\s-1NULL\s0\fR to clear
208 an existing policy set.
209 .PP
210 \&\fIX509_VERIFY_PARAM_set_depth()\fR sets the maximum verification depth to \fBdepth\fR.
211 That is the maximum number of untrusted \s-1CA\s0 certificates that can appear in a
212 chain.
213 .PP
214 \&\fIX509_VERIFY_PARAM_set1_host()\fR sets the expected \s-1DNS\s0 hostname to
215 \&\fBname\fR clearing any previously specified host name or names.  If
216 \&\fBname\fR is \s-1NULL,\s0 or empty the list of hostnames is cleared, and
217 name checks are not performed on the peer certificate.  If \fBname\fR
218 is NUL-terminated, \fBnamelen\fR may be zero, otherwise \fBnamelen\fR
219 must be set to the length of \fBname\fR.  When a hostname is specified,
220 certificate verification automatically invokes \fIX509_check_host\fR\|(3)
221 with flags equal to the \fBflags\fR argument given to
222 \&\fB\f(BIX509_VERIFY_PARAM_set_hostflags()\fB\fR (default zero).  Applications
223 are strongly advised to use this interface in preference to explicitly
224 calling \fIX509_check_host\fR\|(3), hostname checks are out of scope
225 with the \s-1\fIDANE\-EE\s0\fR\|(3) certificate usage, and the internal check will
226 be suppressed as appropriate when \s-1DANE\s0 support is added to OpenSSL.
227 .PP
228 \&\fIX509_VERIFY_PARAM_add1_host()\fR adds \fBname\fR as an additional reference
229 identifer that can match the peer's certificate.  Any previous names
230 set via \fIX509_VERIFY_PARAM_set1_host()\fR or \fIX509_VERIFY_PARAM_add1_host()\fR
231 are retained, no change is made if \fBname\fR is \s-1NULL\s0 or empty.  When
232 multiple names are configured, the peer is considered verified when
233 any name matches.
234 .PP
235 \&\fIX509_VERIFY_PARAM_get0_peername()\fR returns the \s-1DNS\s0 hostname or subject
236 CommonName from the peer certificate that matched one of the reference
237 identifiers.  When wildcard matching is not disabled, or when a
238 reference identifier specifies a parent domain (starts with \*(L".\*(R")
239 rather than a hostname, the peer name may be a wildcard name or a
240 sub-domain of the reference identifier respectively.  The return
241 string is allocated by the library and is no longer valid once the
242 associated \fBparam\fR argument is freed.  Applications must not free
243 the return value.
244 .PP
245 \&\fIX509_VERIFY_PARAM_set1_email()\fR sets the expected \s-1RFC822\s0 email address to
246 \&\fBemail\fR.  If \fBemail\fR is NUL-terminated, \fBemaillen\fR may be zero, otherwise
247 \&\fBemaillen\fR must be set to the length of \fBemail\fR.  When an email address
248 is specified, certificate verification automatically invokes
249 \&\fIX509_check_email\fR\|(3).
250 .PP
251 \&\fIX509_VERIFY_PARAM_set1_ip()\fR sets the expected \s-1IP\s0 address to \fBip\fR.
252 The \fBip\fR argument is in binary format, in network byte-order and
253 \&\fBiplen\fR must be set to 4 for IPv4 and 16 for IPv6.  When an \s-1IP\s0
254 address is specified, certificate verification automatically invokes
255 \&\fIX509_check_ip\fR\|(3).
256 .PP
257 \&\fIX509_VERIFY_PARAM_set1_ip_asc()\fR sets the expected \s-1IP\s0 address to
258 \&\fBipasc\fR.  The \fBipasc\fR argument is a NUL-terminal \s-1ASCII\s0 string:
259 dotted decimal quad for IPv4 and colon-separated hexadecimal for
260 IPv6.  The condensed \*(L"::\*(R" notation is supported for IPv6 addresses.
261 .SH "RETURN VALUES"
262 .IX Header "RETURN VALUES"
263 \&\fIX509_VERIFY_PARAM_set_flags()\fR, \fIX509_VERIFY_PARAM_clear_flags()\fR,
264 \&\fIX509_VERIFY_PARAM_set_purpose()\fR, \fIX509_VERIFY_PARAM_set_trust()\fR,
265 \&\fIX509_VERIFY_PARAM_add0_policy()\fR \fIX509_VERIFY_PARAM_set1_policies()\fR,
266 \&\fIX509_VERIFY_PARAM_set1_host()\fR, \fIX509_VERIFY_PARAM_set_hostflags()\fR,
267 \&\fIX509_VERIFY_PARAM_set1_email()\fR, \fIX509_VERIFY_PARAM_set1_ip()\fR and
268 \&\fIX509_VERIFY_PARAM_set1_ip_asc()\fR return 1 for success and 0 for
269 failure.
270 .PP
271 \&\fIX509_VERIFY_PARAM_get_flags()\fR returns the current verification flags.
272 .PP
273 \&\fIX509_VERIFY_PARAM_set_time()\fR and \fIX509_VERIFY_PARAM_set_depth()\fR do not return
274 values.
275 .PP
276 \&\fIX509_VERIFY_PARAM_get_depth()\fR returns the current verification depth.
277 .SH "VERIFICATION FLAGS"
278 .IX Header "VERIFICATION FLAGS"
279 The verification flags consists of zero or more of the following flags
280 ored together.
281 .PP
282 \&\fBX509_V_FLAG_CRL_CHECK\fR enables \s-1CRL\s0 checking for the certificate chain leaf
283 certificate. An error occurs if a suitable \s-1CRL\s0 cannot be found.
284 .PP
285 \&\fBX509_V_FLAG_CRL_CHECK_ALL\fR enables \s-1CRL\s0 checking for the entire certificate
286 chain.
287 .PP
288 \&\fBX509_V_FLAG_IGNORE_CRITICAL\fR disabled critical extension checking. By default
289 any unhandled critical extensions in certificates or (if checked) CRLs results
290 in a fatal error. If this flag is set unhandled critical extensions are
291 ignored. \fB\s-1WARNING\s0\fR setting this option for anything other than debugging
292 purposes can be a security risk. Finer control over which extensions are
293 supported can be performed in the verification callback.
294 .PP
295 THe \fBX509_V_FLAG_X509_STRICT\fR flag disables workarounds for some broken
296 certificates and makes the verification strictly apply \fBX509\fR rules.
297 .PP
298 \&\fBX509_V_FLAG_ALLOW_PROXY_CERTS\fR enables proxy certificate verification.
299 .PP
300 \&\fBX509_V_FLAG_POLICY_CHECK\fR enables certificate policy checking, by default
301 no policy checking is peformed. Additional information is sent to the 
302 verification callback relating to policy checking.
303 .PP
304 \&\fBX509_V_FLAG_EXPLICIT_POLICY\fR, \fBX509_V_FLAG_INHIBIT_ANY\fR and
305 \&\fBX509_V_FLAG_INHIBIT_MAP\fR set the \fBrequire explicit policy\fR, \fBinhibit any
306 policy\fR and \fBinhibit policy mapping\fR flags respectively as defined in
307 \&\fB\s-1RFC3280\s0\fR. Policy checking is automatically enabled if any of these flags
308 are set.
309 .PP
310 If \fBX509_V_FLAG_NOTIFY_POLICY\fR is set and the policy checking is successful
311 a special status code is set to the verification callback. This permits it
312 to examine the valid policy tree and perform additional checks or simply
313 log it for debugging purposes.
314 .PP
315 By default some additional features such as indirect CRLs and CRLs signed by
316 different keys are disabled. If \fBX509_V_FLAG_EXTENDED_CRL_SUPPORT\fR is set
317 they are enabled.
318 .PP
319 If \fBX509_V_FLAG_USE_DELTAS\fR ise set delta CRLs (if present) are used to
320 determine certificate status. If not set deltas are ignored.
321 .PP
322 \&\fBX509_V_FLAG_CHECK_SS_SIGNATURE\fR enables checking of the root \s-1CA\s0 self signed
323 cerificate signature. By default this check is disabled because it doesn't
324 add any additional security but in some cases applications might want to
325 check the signature anyway. A side effect of not checking the root \s-1CA\s0
326 signature is that disabled or unsupported message digests on the root \s-1CA\s0
327 are not treated as fatal errors.
328 .PP
329 The \fBX509_V_FLAG_CB_ISSUER_CHECK\fR flag enables debugging of certificate
330 issuer checks. It is \fBnot\fR needed unless you are logging certificate
331 verification. If this flag is set then additional status codes will be sent
332 to the verification callback and it \fBmust\fR be prepared to handle such cases
333 without assuming they are hard errors.
334 .PP
335 The \fBX509_V_FLAG_NO_ALT_CHAINS\fR flag suppresses checking for alternative
336 chains. By default, when building a certificate chain, if the first certificate
337 chain found is not trusted, then OpenSSL will continue to check to see if an
338 alternative chain can be found that is trusted. With this flag set the behaviour
339 will match that of OpenSSL versions prior to 1.0.2b.
340 .SH "NOTES"
341 .IX Header "NOTES"
342 The above functions should be used to manipulate verification parameters
343 instead of legacy functions which work in specific structures such as
344 \&\fIX509_STORE_CTX_set_flags()\fR.
345 .SH "BUGS"
346 .IX Header "BUGS"
347 Delta \s-1CRL\s0 checking is currently primitive. Only a single delta can be used and
348 (partly due to limitations of \fBX509_STORE\fR) constructed CRLs are not 
349 maintained.
350 .PP
351 If CRLs checking is enable CRLs are expected to be available in the
352 corresponding \fBX509_STORE\fR structure. No attempt is made to download
353 CRLs from the \s-1CRL\s0 distribution points extension.
354 .SH "EXAMPLE"
355 .IX Header "EXAMPLE"
356 Enable \s-1CRL\s0 checking when performing certificate verification during \s-1SSL \s0
357 connections associated with an \fB\s-1SSL_CTX\s0\fR structure \fBctx\fR:
358 .PP
359 .Vb 5
360 \&  X509_VERIFY_PARAM *param;
361 \&  param = X509_VERIFY_PARAM_new();
362 \&  X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);
363 \&  SSL_CTX_set1_param(ctx, param);
364 \&  X509_VERIFY_PARAM_free(param);
365 .Ve
366 .SH "SEE ALSO"
367 .IX Header "SEE ALSO"
368 \&\fIX509_verify_cert\fR\|(3),
369 \&\fIX509_check_host\fR\|(3),
370 \&\fIX509_check_email\fR\|(3),
371 \&\fIX509_check_ip\fR\|(3)
372 .SH "HISTORY"
373 .IX Header "HISTORY"
374 The \fBX509_V_FLAG_NO_ALT_CHAINS\fR flag was added in OpenSSL 1.0.2b