.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.48) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "X509_VERIFY_PARAM_SET_FLAGS 3ssl" .TH X509_VERIFY_PARAM_SET_FLAGS 3ssl 2026-10-23 4.1.0 OpenSSL .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_get_purpose, X509_VERIFY_PARAM_get_inh_flags, X509_VERIFY_PARAM_set_inh_flags, X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_auth_level, X509_VERIFY_PARAM_get_auth_level, X509_VERIFY_PARAM_set_time, X509_VERIFY_PARAM_get_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies, X509_VERIFY_PARAM_get0_peername \&\- X509 verification parameters .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& 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(const X509_VERIFY_PARAM *param); \& \& int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param, \& uint32_t flags); \& uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param); \& \& int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); \& int X509_VERIFY_PARAM_get_purpose(X509_VERIFY_PARAM *param); \& int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); \& \& void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); \& time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param); \& \& 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); \& \& void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); \& int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); \& \& void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, \& int auth_level); \& int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param); \& \& char *X509_VERIFY_PARAM_get0_peername(const X509_VERIFY_PARAM *param); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" An \fBX509_VERIFY_PARAM\fR object collects the configuration consumed by a certificate verification operation: the verification flags, the purpose and trust selectors, the verification time, the maximum chain depth, the required security level, the acceptable certificate policies, and the reference identifiers against which the peer certificate\*(Aqs names are matched. \fBX509_VERIFY_PARAM\fR objects are typically attached to an \&\fBX509_STORE\fR or an \fBSSL_CTX\fR/\fBSSL\fR and reach \fBX509_verify_cert\fR\|(3) through the \fBX509_STORE_CTX\fR being verified; values propagate from one parameter set to another according to the rules in "INHERITANCE FLAGS". .PP These functions manipulate an \fBX509_VERIFY_PARAM\fR. The functions for configuring its reference identifiers (hostnames, email addresses, and IP addresses) are documented in \&\fBX509_VERIFY_PARAM_set1_host\fR\|(3). .PP The \fBX509_VERIFY_PARAM_set_flags()\fR function sets the flags in \fIparam\fR by ORing it with \fIflags\fR. See "VERIFICATION FLAGS" for a complete description of values the \fIflags\fR parameter can take. .PP \&\fBX509_VERIFY_PARAM_clear_flags()\fR clears the flags \fIflags\fR in \fIparam\fR. .PP \&\fBX509_VERIFY_PARAM_get_flags()\fR returns the flags in \fIparam\fR. .PP \&\fBX509_VERIFY_PARAM_get_inh_flags()\fR returns the inheritance flags in \fIparam\fR which specifies how verification flags are copied from one structure to another. \fBX509_VERIFY_PARAM_set_inh_flags()\fR sets the inheritance flags. See the "INHERITANCE FLAGS" section for a description of these bits. .PP \&\fBX509_VERIFY_PARAM_set_purpose()\fR sets the verification purpose in \fIparam\fR to \fIpurpose\fR. This determines the acceptable purpose of the certificate chain, for example \fBX509_PURPOSE_SSL_CLIENT\fR. The purpose requirement is cleared if \fIpurpose\fR is \fBX509_PURPOSE_DEFAULT_ANY\fR. .PP \&\fBX509_VERIFY_PARAM_get_purpose()\fR returns the purpose in \fIparam\fR. .PP \&\fBX509_VERIFY_PARAM_set_trust()\fR sets the trust selector in \fIparam\fR to \&\fItrust\fR, which must be one of the \fBX509_TRUST_*\fR identifiers defined in \fIopenssl/x509_vfy.h\fR. This is a legacy mechanism that most applications should not use; see "BUGS". There is no public getter for the trust selector. .PP \&\fBX509_VERIFY_PARAM_set_time()\fR sets the verification time in \fIparam\fR to \&\fIt\fR, which is then used as the reference time for certificate and CRL validity\-period checks in place of the current time. Calling this function automatically sets the \fBX509_V_FLAG_USE_CHECK_TIME\fR flag (see "Validity period (time)"). If \fBX509_VERIFY_PARAM_set_time()\fR has not been called, validity checks are performed against the current time. .PP \&\fBX509_VERIFY_PARAM_get_time()\fR returns the verification time configured on \&\fIparam\fR. .PP \&\fBX509_VERIFY_PARAM_add0_policy()\fR adds \fIpolicy\fR to the acceptable policy set. Policy checking itself must be enabled separately, either by setting \&\fBX509_V_FLAG_POLICY_CHECK\fR via \fBX509_VERIFY_PARAM_set_flags()\fR or by calling \fBX509_VERIFY_PARAM_set1_policies()\fR. .PP \&\fBX509_VERIFY_PARAM_set1_policies()\fR enables policy checking (it is disabled by default) and sets the acceptable policy set to \fIpolicies\fR. Any existing policy set is cleared. The \fIpolicies\fR parameter can be NULL to clear an existing policy set. .PP \&\fBX509_VERIFY_PARAM_set_depth()\fR sets the maximum verification depth to \&\fIdepth\fR. That is the maximum number of intermediate CA certificates that can appear in a chain. If \fBX509_VERIFY_PARAM_set_depth()\fR is not called, the verification depth defaults to 100. A maximal depth chain contains 2 more certificates than the limit, since neither the end\-entity certificate nor the trust\-anchor count against this limit. Thus a \fIdepth\fR limit of 0 only allows the end\-entity certificate to be signed directly by the trust anchor, while with a \fIdepth\fR limit of 1 there can be one intermediate CA certificate between the trust anchor and the end\-entity certificate. .PP \&\fBX509_VERIFY_PARAM_set_auth_level()\fR sets the authentication security level to \&\fIauth_level\fR. The authentication security level determines the acceptable signature and public key strength when verifying certificate chains. For a certificate chain to validate, the public keys of all the certificates must meet the specified security level. The signature algorithm security level is not enforced for the chain\*(Aqs \fItrust anchor\fR certificate, which is either directly trusted or validated by means other than its signature. See \fBSSL_CTX_set_security_level\fR\|(3) for the definitions of the available levels. The default security level is \-1, or "not set". At security level 0 or lower all algorithms are acceptable. Security level 1 requires at least 80\-bit\-equivalent security and is broadly interoperable, though it will, for example, reject MD5 signatures or RSA keys shorter than 1024 bits. .PP The remaining accessor on this page reports a result populated during certificate verification rather than a configured parameter: \&\fBX509_VERIFY_PARAM_get0_peername()\fR returns the DNS hostname or subject CommonName from the peer certificate that matched one of the reference identifiers. When wildcard matching is not disabled, or when a reference identifier specifies a parent domain (starts with "."), rather than a hostname, the peer name may be a wildcard name or a sub\-domain of the reference identifier respectively. The returned string is allocated by the library and is no longer valid once the associated \fIparam\fR argument is freed. Applications must not free the return value. .SH "RETURN VALUES" .IX Header "RETURN VALUES" \&\fBX509_VERIFY_PARAM_set_flags()\fR, \fBX509_VERIFY_PARAM_clear_flags()\fR, \&\fBX509_VERIFY_PARAM_set_inh_flags()\fR, \&\fBX509_VERIFY_PARAM_set_purpose()\fR, \fBX509_VERIFY_PARAM_set_trust()\fR, \&\fBX509_VERIFY_PARAM_add0_policy()\fR, and \fBX509_VERIFY_PARAM_set1_policies()\fR return 1 for success and 0 for failure. .PP \&\fBX509_VERIFY_PARAM_get0_peername()\fR returns a pointer to the name from the peer certificate that matched a configured reference identifier, or NULL if no match has been recorded. .PP \&\fBX509_VERIFY_PARAM_get_flags()\fR returns the current verification flags. .PP \&\fBX509_VERIFY_PARAM_get_inh_flags()\fR returns the current inheritance flags. .PP \&\fBX509_VERIFY_PARAM_set_time()\fR, \fBX509_VERIFY_PARAM_set_depth()\fR, and \&\fBX509_VERIFY_PARAM_set_auth_level()\fR do not return values. .PP \&\fBX509_VERIFY_PARAM_get_time()\fR returns the verification time previously configured on \fIparam\fR via \fBX509_VERIFY_PARAM_set_time()\fR. .PP \&\fBX509_VERIFY_PARAM_get_depth()\fR returns the current verification depth. .PP \&\fBX509_VERIFY_PARAM_get_auth_level()\fR returns the current authentication security level. .PP \&\fBX509_VERIFY_PARAM_get_purpose()\fR returns the current purpose, which may be \fBX509_PURPOSE_DEFAULT_ANY\fR if unset. .SH "VERIFICATION FLAGS" .IX Header "VERIFICATION FLAGS" The verification flags consist of zero or more of the following values ORed together. Unless noted otherwise, each flag is off by default. .SS "Revocation checking" .IX Subsection "Revocation checking" \&\fBX509_V_FLAG_CRL_CHECK\fR enables CRL checking for the certificate chain leaf certificate. An error occurs if a suitable CRL cannot be found. .PP \&\fBX509_V_FLAG_CRL_CHECK_ALL\fR expands CRL checking to the entire certificate chain if \fBX509_V_FLAG_CRL_CHECK\fR has also been enabled, and is otherwise ignored. .PP \&\fBX509_V_FLAG_OCSP_RESP_CHECK\fR enables Online Certificate Status Protocol (OCSP) checking for the certificate chain leaf certificate. An error occurs if a suitable OCSP response cannot be found. .PP \&\fBX509_V_FLAG_OCSP_RESP_CHECK_ALL\fR expands OCSP checking to the entire certificate chain if \fBX509_V_FLAG_OCSP_RESP_CHECK\fR has also been enabled, and is otherwise ignored. .PP If \fBX509_V_FLAG_EXTENDED_CRL_SUPPORT\fR is set, some additional features such as indirect CRLs and CRLs signed by different keys are enabled. By default these features are disabled. .PP If \fBX509_V_FLAG_USE_DELTAS\fR is set, delta CRLs (if present) are used to determine certificate status. If not set, deltas are ignored. .SS "Certificate policy checking" .IX Subsection "Certificate policy checking" \&\fBX509_V_FLAG_POLICY_CHECK\fR enables certificate policy checking. By default no policy checking is performed. Additional information is sent to the verification callback relating to policy checking. .PP \&\fBX509_V_FLAG_EXPLICIT_POLICY\fR, \fBX509_V_FLAG_INHIBIT_ANY\fR, and \&\fBX509_V_FLAG_INHIBIT_MAP\fR set the \f(CW\*(C`require explicit policy\*(C'\fR, \f(CW\*(C`inhibit any policy\*(C'\fR, and \f(CW\*(C`inhibit policy mapping\*(C'\fR flags respectively as defined in RFC 5280. Policy checking is automatically enabled if any of these flags is set. .PP If \fBX509_V_FLAG_NOTIFY_POLICY\fR is set and policy checking is successful, a special status code is delivered to the verification callback. This permits the callback to examine the valid policy tree and perform additional checks, or simply to log it for debugging purposes. .SS "Chain construction" .IX Subsection "Chain construction" When \fBX509_V_FLAG_TRUSTED_FIRST\fR is set, which is the default since OpenSSL 1.1.0, construction of the certificate chain in \&\fBX509_verify_cert\fR\|(3) searches the trust store for issuer certificates before searching the provided untrusted certificates. Local issuer certificates are often more likely to satisfy local security requirements and lead to a locally trusted root. This is especially important when some certificates in the trust store have explicit trust settings (see "TRUST SETTINGS" in \fBopenssl\-x509\fR\|(1)). .PP The \fBX509_V_FLAG_NO_ALT_CHAINS\fR flag suppresses checking for alternative chains. By default, when the initial untrusted\-first chain fails to reach a trust anchor, the build is retried with progressively shorter untrusted prefixes in an attempt to find an alternative. .PP The \fBX509_V_FLAG_PARTIAL_CHAIN\fR flag causes non\-self\-signed certificates in the trust store to be treated as trust anchors, in the same way as self\-signed root CA certificates. This makes it possible to trust self\-issued certificates as well as certificates issued by an intermediate CA without having to trust their ancestor root CA. With \&\fBX509_V_FLAG_PARTIAL_CHAIN\fR set, chain construction stops as soon as the first certificate contained in the trust store is added to the chain, whether that certificate is a self\-signed "root" certificate or a not self\-signed "intermediate" or self\-issued certificate. Thus, when an intermediate certificate is found in the trust store, the verified chain passed to callbacks may be shorter than it otherwise would be without the \fBX509_V_FLAG_PARTIAL_CHAIN\fR flag. .PP \&\fBX509_V_FLAG_CHECK_SS_SIGNATURE\fR requests checking the signature of the last certificate in a chain if the certificate is supposedly self\-signed. This is prohibited and will result in an error if it is a non\-conforming CA certificate with key usage restrictions not including the \fIkeyCertSign\fR bit. By default this check is disabled because it does not add any additional security, but in some cases applications might want to check the signature anyway. A side effect of not checking the self\-signature of such a certificate is that disabled or unsupported message digests used for the signature are not treated as fatal errors. .SS "Validity period (time)" .IX Subsection "Validity period (time)" \&\fBX509_V_FLAG_USE_CHECK_TIME\fR indicates that the time stored on the parameters should be used for validity period checks in place of the current time. This flag is set automatically by \&\fBX509_VERIFY_PARAM_set_time()\fR; applications do not normally manipulate it directly. .PP The \fBX509_V_FLAG_NO_CHECK_TIME\fR flag suppresses checking the validity period of certificates and CRLs against the current time. If \&\fBX509_VERIFY_PARAM_set_time()\fR has been used to specify a verification time, the check is performed against the specified time and this flag has no effect. .SS "Extension processing and strictness" .IX Subsection "Extension processing and strictness" \&\fBX509_V_FLAG_IGNORE_CRITICAL\fR disables critical extension checking. By default, any unhandled critical extensions in certificates or (if checked) CRLs result in a fatal error. If this flag is set, unhandled critical extensions are ignored. \fBWARNING:\fR 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. .PP The \fBX509_V_FLAG_X509_STRICT\fR flag disables workarounds for some broken certificates and makes verification strictly apply \fBX509\fR rules. .PP \&\fBX509_V_FLAG_ALLOW_PROXY_CERTS\fR enables proxy certificate verification. By default, proxy certificates are not accepted. .SS "Suite B compliance" .IX Subsection "Suite B compliance" These flags enable enforcement of the NSA Suite B cryptographic profile, a now\-legacy profile that restricts chain validation to a specific subset of elliptic\-curve algorithms. Suite B has been superseded by NSA\*(Aqs Commercial National Security Algorithm (CNSA) Suite for new deployments. .PP \&\fBX509_V_FLAG_SUITEB_128_LOS_ONLY\fR restricts the chain to the Suite B 128\-bit level of security: certificates must use the NIST P\-256 curve with ECDSA and SHA\-256. .PP \&\fBX509_V_FLAG_SUITEB_192_LOS\fR restricts the chain to the Suite B 192\-bit level of security: certificates must use the NIST P\-384 curve with ECDSA and SHA\-384. .PP \&\fBX509_V_FLAG_SUITEB_128_LOS\fR is the bitwise OR of the two flags above and permits either level of security in the chain, with the constraint that once a P\-384 certificate has appeared in the chain, P\-256 certificates may not subsequently be used. .SH "INHERITANCE FLAGS" .IX Header "INHERITANCE FLAGS" These flags control how the values stored in one \fBX509_VERIFY_PARAM\fR are copied into another when verification parameters are "inherited", for example when an \fBSSL\fR object inherits its verification parameters from the \fBSSL_CTX\fR that created it. In the descriptions below, "from" refers to the source \fBX509_VERIFY_PARAM\fR from which values are copied, and "to" refers to the destination \fBX509_VERIFY_PARAM\fR into which they are copied. .PP If \fBX509_VP_FLAG_ONCE\fR is set then the current setting is zeroed after the next call. .PP If \fBX509_VP_FLAG_LOCKED\fR is set then no values are copied. This overrides all of the following flags. .PP If \fBX509_VP_FLAG_DEFAULT\fR is set then anything set in the source is copied to the destination. Effectively the values in "to" become default values which will be used only if nothing new is set in "from". This is the default. .PP If \fBX509_VP_FLAG_OVERWRITE\fR is set then all values are copied across whether they are set or not. Flags are still ORed though. .PP If \fBX509_VP_FLAG_RESET_FLAGS\fR is set then the flags value is copied instead of ORed. .SH NOTES .IX Header "NOTES" The above functions should be used to manipulate verification parameters instead of functions which work in specific structures such as \&\fBX509_STORE_CTX_set_flags()\fR which are likely to be deprecated in a future release. .PP TLS clients are recommended to set up validation of server hostname(s) and/or IP address (directly using the functions described in \&\fBX509_VERIFY_PARAM_set1_host\fR\|(3), or more conveniently using \&\fBSSL_set1_host\fR\|(3) or \fBSSL_add1_host\fR\|(3)) and to use \&\fBSSL_set_tlsext_host_name\fR\|(3) for Server Name Indication (SNI), which may be crucial also for correct routing of the connection request. .SH BUGS .IX Header "BUGS" Delta CRL checking is currently primitive. Only a single delta can be used and (partly due to limitations of \fBX509_STORE\fR) constructed CRLs are not maintained. .PP If CRL checking is enabled, CRLs are expected to be available in the corresponding \fBX509_STORE\fR structure. No attempt is made to download CRLs from the CRL distribution points extension. .PP The \fBX509_TRUST_*\fR selectors used by \fBX509_VERIFY_PARAM_set_trust()\fR are deceptively named: although each mirrors a PKIX extended key usage, the selector does not check that \fBextKeyUsage\fR. It matches only auxiliary trust information that is never carried in the certificate itself but must be attached to the in\-memory \fBX509\fR object by the application; absent that, the selector has no effect. Use \&\fBX509_VERIFY_PARAM_set_purpose()\fR to constrain a certificate by its extended key usage instead. .SH EXAMPLES .IX Header "EXAMPLES" Enable CRL checking when performing certificate verification during SSL connections associated with an \fBSSL_CTX\fR structure \fIctx\fR: .PP .Vb 1 \& 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); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBSSL_CTX_set_security_level\fR\|(3), \&\fBX509_verify_cert\fR\|(3), \&\fBX509_VERIFY_PARAM_set1_host\fR\|(3), \&\fBX509_VERIFY_PARAM_set_hostflags\fR\|(3), \&\fBX509_check_host\fR\|(3), \&\fBX509_check_email\fR\|(3), \&\fBX509_check_ip\fR\|(3), \&\fBSSL_set_tlsext_host_name\fR\|(3), \&\fBopenssl\-x509\fR\|(1) .SH HISTORY .IX Header "HISTORY" Until OpenSSL 1.1.0, by default (unless \fBX509_V_FLAG_TRUSTED_FIRST\fR was set), when building a certificate chain, if the first certificate chain found was not trusted, OpenSSL would attempt to replace untrusted certificates supplied by the peer with certificates from the trust store to see if an alternative chain can be found that is trusted. Since OpenSSL 1.1.0 version, the \fBX509_V_FLAG_TRUSTED_FIRST\fR is set by default. .PP The \fBX509_V_FLAG_NO_ALT_CHAINS\fR flag was added in OpenSSL 1.1.0. The flag \fBX509_V_FLAG_CB_ISSUER_CHECK\fR was deprecated in OpenSSL 1.1.0 and has no effect. .PP The function \fBX509_VERIFY_PARAM_add0_policy()\fR was historically documented as enabling policy checking however the implementation has never done this. The documentation was changed to align with the implementation. .PP The \fBX509_VERIFY_PARAM_get_purpose()\fR function was added in OpenSSL 3.5. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2009\-2026 The OpenSSL Project Authors. All Rights Reserved. .PP Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at .