
#use wml::openssl-macros area=docs page=X509_VERIFY_PARAM_set_flags

<title>Documents, X509_VERIFY_PARAM_set_flags(3)</title>

<h1>X509_VERIFY_PARAM_set_flags(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#VERIFICATION_FLAGS">VERIFICATION FLAGS</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#BUGS">BUGS</A>
	<LI><A HREF="#EXAMPLE">EXAMPLE</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
	<LI><A HREF="#HISTORY">HISTORY</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
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
verification parameters 

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/x509_vfy.h&gt;
</PRE>
<PRE> int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
 int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
                                                        unsigned long flags);
 unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
</PRE>
<PRE> int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
 int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
</PRE>
<PRE> void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
</PRE>
<PRE> int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
                                                ASN1_OBJECT *policy);
 int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, 
                                        STACK_OF(ASN1_OBJECT) *policies);
</PRE>
<PRE> void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
 int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
These functions manipulate the <STRONG>X509_VERIFY_PARAM</STRONG> structure associated with a certificate verification operation. 

</P>
<P>
The <CODE>X509_VERIFY_PARAM_set_flags()</CODE> function sets the flags in <STRONG>param</STRONG> by oring it with <STRONG>flags</STRONG>. See the <STRONG>VERIFICATION FLAGS</STRONG> section for a complete description of values the <STRONG>flags</STRONG> parameter can take.

</P>
<P>
<CODE>X509_VERIFY_PARAM_get_flags()</CODE> returns the flags in <STRONG>param</STRONG>.

</P>
<P>
<CODE>X509_VERIFY_PARAM_clear_flags()</CODE> clears the flags <STRONG>flags</STRONG> in <STRONG>param</STRONG>.

</P>
<P>
<CODE>X509_VERIFY_PARAM_set_purpose()</CODE> sets the verification purpose
in <STRONG>param</STRONG>
to <STRONG>purpose</STRONG>. This determines the acceptable purpose of the certificate chain, for
example SSL client or SSL server.

</P>
<P>
<CODE>X509_VERIFY_PARAM_set_trust()</CODE> sets the trust setting in <STRONG>param</STRONG> to 
<STRONG>trust</STRONG>.

</P>
<P>
<CODE>X509_VERIFY_PARAM_set_time()</CODE> sets the verification time in <STRONG>param</STRONG> to
<STRONG>t</STRONG>. Normally the current time is used.

</P>
<P>
<CODE>X509_VERIFY_PARAM_add0_policy()</CODE> enables policy checking (it is
disabled by default) and adds <STRONG>policy</STRONG> to the acceptable policy set.

</P>
<P>
<CODE>X509_VERIFY_PARAM_set1_policies()</CODE> enables policy checking (it
is disabled by default) and sets the acceptable policy set to <STRONG>policies</STRONG>. Any existing policy set is cleared. The <STRONG>policies</STRONG> parameter can be <STRONG>NULL</STRONG> to clear an existing policy set.

</P>
<P>
<CODE>X509_VERIFY_PARAM_set_depth()</CODE> sets the maximum verification
depth to <STRONG>depth</STRONG>. That is the maximum number of untrusted CA certificates that can appear
in a chain.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
<CODE>X509_VERIFY_PARAM_set_flags(),</CODE>
<CODE>X509_VERIFY_PARAM_clear_flags(),</CODE>
<CODE>X509_VERIFY_PARAM_set_purpose(),</CODE>
<CODE>X509_VERIFY_PARAM_set_trust(),</CODE>
<CODE>X509_VERIFY_PARAM_add0_policy()</CODE> and
<CODE>X509_VERIFY_PARAM_set1_policies()</CODE> return 1 for success and 0
for failure. 

</P>
<P>
<CODE>X509_VERIFY_PARAM_get_flags()</CODE> returns the current verification
flags.

</P>
<P>
<CODE>X509_VERIFY_PARAM_set_time()</CODE> and
<CODE>X509_VERIFY_PARAM_set_depth()</CODE> do not return values.

</P>
<P>
<CODE>X509_VERIFY_PARAM_get_depth()</CODE> returns the current verification
depth.

</P>
<P>
<HR>
<H1><A NAME="VERIFICATION_FLAGS">VERIFICATION FLAGS</A></H1>
<P>
The verification flags consists of zero or more of the following flags ored
together.

</P>
<P>
<STRONG>X509_V_FLAG_CRL_CHECK</STRONG> enables CRL checking for the certificate chain leaf certificate. An error
occurs if a suitable CRL cannot be found. 

</P>
<P>
<STRONG>X509_V_FLAG_CRL_CHECK_ALL</STRONG> enables CRL checking for the entire certificate chain.

</P>
<P>
<STRONG>X509_V_FLAG_IGNORE_CRITICAL</STRONG> disabled critical extension checking. By default any unhandled critical
extensions in certificates or (if checked) CRLs results in a fatal error.
If this flag is set unhandled critical extensions are ignored. <STRONG>WARNING</STRONG> setting this option for anything other than debugging purposes can be a
security risk. Finer control over which extensions are supported can be
performed in the verification callback.

</P>
<P>
THe <STRONG>X509_V_FLAG_X509_STRICT</STRONG> flag disables workarounds for some broken certificates and makes the
verification strictly apply <STRONG>X509</STRONG> rules.

</P>
<P>
<STRONG>X509_V_FLAG_ALLOW_PROXY_CERTS</STRONG> enables proxy certificate verification.

</P>
<P>
<STRONG>X509_V_FLAG_POLICY_CHECK</STRONG> enables certificate policy checking, by default no policy checking is
peformed. Additional information is sent to the verification callback
relating to policy checking.

</P>
<P>
<STRONG>X509_V_FLAG_EXPLICIT_POLICY</STRONG>, <STRONG>X509_V_FLAG_INHIBIT_ANY</STRONG> and
<STRONG>X509_V_FLAG_INHIBIT_MAP</STRONG> set the <STRONG>require explicit policy</STRONG>, <STRONG>inhibit any
policy</STRONG> and <STRONG>inhibit policy mapping</STRONG> flags respectively as defined in
<STRONG>RFC3280</STRONG>. Policy checking is automatically enabled if any of these flags are set.

</P>
<P>
If <STRONG>X509_V_FLAG_NOTIFY_POLICY</STRONG> is set and the policy checking is successful a special status code is set
to the verification callback. This permits it to examine the valid policy
tree and perform additional checks or simply log it for debugging purposes.

</P>
<P>
By default some addtional features such as indirect CRLs and CRLs signed by
different keys are disabled. If <STRONG>X509_V_FLAG_EXTENDED_CRL_SUPPORT</STRONG> is set they are enabled.

</P>
<P>
If <STRONG>X509_V_FLAG_USE_DELTAS</STRONG> ise set delta CRLs (if present) are used to determine certificate status.
If not set deltas are ignored.

</P>
<P>
<STRONG>X509_V_FLAG_CHECK_SS_SIGNATURE</STRONG> enables checking of the root CA self signed cerificate signature. By
default this check is disabled because it doesn't add any additional
security but in some cases applications might want to check the signature
anyway. A side effect of not checking the root CA signature is that
disabled or unsupported message digests on the root CA are not treated as
fatal errors.

</P>
<P>
The <STRONG>X509_V_FLAG_CB_ISSUER_CHECK</STRONG> flag enables debugging of certificate issuer checks. It is <STRONG>not</STRONG> needed unless you are logging certificate verification. If this flag is set
then additional status codes will be sent to the verification callback and
it <STRONG>must</STRONG> be prepared to handle such cases without assuming they are hard errors.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
The above functions should be used to manipulate verification parameters
instead of legacy functions which work in specific structures such as
<CODE>X509_STORE_CTX_set_flags().</CODE>

</P>
<P>
<HR>
<H1><A NAME="BUGS">BUGS</A></H1>
<P>
Delta CRL checking is currently primitive. Only a single delta can be used
and (partly due to limitations of <STRONG>X509_STORE</STRONG>) constructed CRLs are not maintained.

</P>
<P>
If CRLs checking is enable CRLs are expected to be available in the
corresponding <STRONG>X509_STORE</STRONG> structure. No attempt is made to download CRLs from the CRL distribution
points extension.

</P>
<P>
<HR>
<H1><A NAME="EXAMPLE">EXAMPLE</A></H1>
<P>
Enable CRL checking when performing certificate verification during SSL
connections associated with an <STRONG>SSL_CTX</STRONG> structure <STRONG>ctx</STRONG>:

</P>
<PRE>  X509_VERIFY_PARAM *param;
  param = X509_VERIFY_PARAM_new();
  X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK);
  SSL_CTX_set1_param(ctx, param);
  X509_VERIFY_PARAM_free(param);
</PRE>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../crypto/X509_verify_cert.html#">X509_verify_cert(3)</A>



</P>
<P>
<HR>
<H1><A NAME="HISTORY">HISTORY</A></H1>
<P>
TBA

</P>
:}


