# PKIXBuilderParameters

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# PKIXBuilderParameters

```
open class PKIXBuilderParameters : PKIXParameters
```

|---|---|--------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                          |||
| ↳ | [java.security.cert.PKIXParameters](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters)                   ||
|   | ↳ | [java.security.cert.PKIXBuilderParameters](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#) |

Parameters used as input for the PKIX`CertPathBuilder`algorithm.

A PKIX`CertPathBuilder`uses these parameters to[build](https://developer.android.com/reference/kotlin/java/security/cert/CertPathBuilder#build(java.security.cert.CertPathParameters))a`CertPath`which has been validated according to the PKIX certification path validation algorithm.

To instantiate a`PKIXBuilderParameters`object, an application must specify one or more*most-trusted CAs* as defined by the PKIX certification path validation algorithm. The most-trusted CA can be specified using one of two constructors. An application can call[PKIXBuilderParameters(Set, CertSelector)](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#PKIXBuilderParameters(kotlin.collections.MutableSet,%20java.security.cert.CertSelector)), specifying a`Set`of`TrustAnchor`objects, each of which identifies a most-trusted CA. Alternatively, an application can call[PKIXBuilderParameters(KeyStore, CertSelector)](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#PKIXBuilderParameters(java.security.KeyStore,%20java.security.cert.CertSelector)), specifying a`KeyStore`instance containing trusted certificate entries, each of which will be considered as a most-trusted CA.

In addition, an application must specify constraints on the target certificate that the`CertPathBuilder`will attempt to build a path to. The constraints are specified as a`CertSelector`object. These constraints should provide the`CertPathBuilder`with enough search criteria to find the target certificate. Minimal criteria for an`X509Certificate`usually include the subject name and/or one or more subject alternative names. If enough criteria is not specified, the`CertPathBuilder`may throw a`CertPathBuilderException`.

**Concurrent Access**

Unless otherwise specified, the methods defined in this class are not thread-safe. Multiple threads that need to access a single object concurrently should synchronize amongst themselves and provide the necessary locking. Multiple threads each manipulating separate objects need not synchronize.

## Summary

|                                                                                                                                                                                                                                                                                                                   Public constructors                                                                                                                                                                                                                                                                                                                   ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [PKIXBuilderParameters](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#PKIXBuilderParameters(java.security.KeyStore,%20java.security.cert.CertSelector))`(`keystore:` `[KeyStore](https://developer.android.com/reference/kotlin/java/security/KeyStore.html#)!`, `targetConstraints:` `[CertSelector](https://developer.android.com/reference/kotlin/java/security/cert/CertSelector)!`)` Creates an instance of`PKIXBuilderParameters`that populates the set of most-trusted CAs from the trusted certificate entries contained in the specified`KeyStore`.                                               |
| [PKIXBuilderParameters](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#PKIXBuilderParameters(kotlin.collections.MutableSet,%20java.security.cert.CertSelector))`(`trustAnchors:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[TrustAnchor](https://developer.android.com/reference/kotlin/java/security/cert/TrustAnchor)!>!`, `targetConstraints:` `[CertSelector](https://developer.android.com/reference/kotlin/java/security/cert/CertSelector)!`)` Creates an instance of`PKIXBuilderParameters`with the specified`Set`of most-trusted CAs. |

|                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                       ||
|--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [getMaxPathLength](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#getMaxPathLength())`()` Returns the value of the maximum number of intermediate non-self-issued certificates that may exist in a certification path.                                                                                                     |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)     | [setMaxPathLength](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#setMaxPathLength(kotlin.Int))`(`maxPathLength:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the value of the maximum number of non-self-issued intermediate certificates that may exist in a certification path. |
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#toString())`()` Returns a formatted string describing the parameters.                                                                                                                                                                                            |

| Inherited functions ||
|---|---|
| From class[PKIXParameters](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters) |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [addCertPathChecker](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#addCertPathChecker(java.security.cert.PKIXCertPathChecker))`(`checker:` `[PKIXCertPathChecker](https://developer.android.com/reference/kotlin/java/security/cert/PKIXCertPathChecker)!`)` <br /> Adds a`PKIXCertPathChecker`to the list of certification path checkers. See the[setCertPathCheckers](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setCertPathCheckers(kotlin.collections.MutableList))method for more details. Note that the`PKIXCertPathChecker`is cloned to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [addCertStore](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#addCertStore(java.security.cert.CertStore))`(`store:` `[CertStore](https://developer.android.com/reference/kotlin/java/security/cert/CertStore)!`)` <br /> Adds a`CertStore`to the end of the list of`CertStore`s used in finding certificates and CRLs. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                                                              | [clone](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#clone())`()` <br /> Makes a copy of this`PKIXParameters`object. Changes to the copy will not affect the original and vice versa. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[PKIXCertPathChecker](https://developer.android.com/reference/kotlin/java/security/cert/PKIXCertPathChecker)!>! | [getCertPathCheckers](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getCertPathCheckers())`()` <br /> Returns the`List`of certification path checkers. The returned`List`is immutable, and each`PKIXCertPathChecker`in the`List`is cloned to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[CertStore](https://developer.android.com/reference/kotlin/java/security/cert/CertStore)!>!                     | [getCertStores](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getCertStores())`()` <br /> Returns an immutable`List`of`CertStore`s that are used to find certificates and CRLs. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Date](https://developer.android.com/reference/kotlin/java/util/Date.html#)!                                                                                                                                            | [getDate](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getDate())`()` <br /> Returns the time for which the validity of the certification path should be determined. If`null`, the current time is used. Note that the`Date`returned is copied to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>!                               | [getInitialPolicies](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getInitialPolicies())`()` <br /> Returns an immutable`Set`of initial policy identifiers (OID strings), indicating that any one of these policies would be acceptable to the certificate user for the purposes of certification path processing. The default return value is an empty`Set`, which is interpreted as meaning that any policy would be acceptable. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                      | [getPolicyQualifiersRejected](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getPolicyQualifiersRejected())`()` <br /> Gets the PolicyQualifiersRejected flag. If this flag is true, certificates that include policy qualifiers in a certificate policies extension that is marked critical are rejected. If the flag is false, certificates are not rejected on this basis. When a`PKIXParameters`object is created, this flag is set to true. This setting reflects the most common (and simplest) strategy for processing policy qualifiers. Applications that want to use a more sophisticated policy must set this flag to false. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!                                                                                                                                       | [getSigProvider](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getSigProvider())`()` <br /> Returns the signature provider's name, or`null`if not set. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [CertSelector](https://developer.android.com/reference/kotlin/java/security/cert/CertSelector)!                                                                                                                         | [getTargetCertConstraints](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getTargetCertConstraints())`()` <br /> Returns the required constraints on the target certificate. The constraints are returned as an instance of`CertSelector`. If`null`, no constraints are defined. Note that the`CertSelector`returned is cloned to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[TrustAnchor](https://developer.android.com/reference/kotlin/java/security/cert/TrustAnchor)!>!                   | [getTrustAnchors](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#getTrustAnchors())`()` <br /> Returns an immutable`Set`of the most-trusted CAs. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                      | [isAnyPolicyInhibited](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#isAnyPolicyInhibited())`()` <br /> Checks whether the any policy OID should be processed if it is included in a certificate. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                      | [isExplicitPolicyRequired](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#isExplicitPolicyRequired())`()` <br /> Checks if explicit policy is required. If this flag is true, an acceptable policy needs to be explicitly identified in every certificate. By default, the ExplicitPolicyRequired flag is false. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                      | [isPolicyMappingInhibited](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#isPolicyMappingInhibited())`()` <br /> Checks if policy mapping is inhibited. If this flag is true, policy mapping is inhibited. By default, policy mapping is not inhibited (the flag is false). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                      | [isRevocationEnabled](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#isRevocationEnabled())`()` <br /> Checks the RevocationEnabled flag. If this flag is true, the default revocation checking mechanism of the underlying PKIX service provider will be used. If this flag is false, the default revocation checking mechanism will be disabled (not used). See the[setRevocationEnabled](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setRevocationEnabled(kotlin.Boolean))method for more details on setting the value of this flag. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setAnyPolicyInhibited](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setAnyPolicyInhibited(kotlin.Boolean))`(`val:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Sets state to determine if the any policy OID should be processed if it is included in a certificate. By default, the any policy OID is not inhibited ([isAnyPolicyInhibited()](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#isAnyPolicyInhibited())returns`false`). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setCertPathCheckers](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setCertPathCheckers(kotlin.collections.MutableList))`(`checkers:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[PKIXCertPathChecker](https://developer.android.com/reference/kotlin/java/security/cert/PKIXCertPathChecker)!>!`)` <br /> Sets a`List`of additional certification path checkers. If the specified`List`contains an object that is not a`PKIXCertPathChecker`, it is ignored. Each`PKIXCertPathChecker`specified implements additional checks on a certificate. Typically, these are checks to process and verify private extensions contained in certificates. Each`PKIXCertPathChecker`should be instantiated with any initialization parameters needed to execute the check. This method allows sophisticated applications to extend a PKIX`CertPathValidator`or`CertPathBuilder`. Each of the specified`PKIXCertPathChecker`s will be called, in turn, by a PKIX`CertPathValidator`or`CertPathBuilder`for each certificate processed or validated. Regardless of whether these additional`PKIXCertPathChecker`s are set, a PKIX`CertPathValidator`or`CertPathBuilder`must perform all of the required PKIX checks on each certificate. The one exception to this rule is if the RevocationEnabled flag is set to false (see the[setRevocationEnabled](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setRevocationEnabled(kotlin.Boolean))method). Note that the`List`supplied here is copied and each`PKIXCertPathChecker`in the list is cloned to protect against subsequent modifications. <br /> | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setCertStores](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setCertStores(kotlin.collections.MutableList))`(`stores:` `[MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[CertStore](https://developer.android.com/reference/kotlin/java/security/cert/CertStore)!>!`)` <br /> Sets the list of`CertStore`s to be used in finding certificates and CRLs. May be`null`, in which case no`CertStore`s will be used. The first`CertStore`s in the list may be preferred to those that appear later. Note that the`List`is copied to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setDate](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setDate(java.util.Date))`(`date:` `[Date](https://developer.android.com/reference/kotlin/java/util/Date.html#)!`)` <br /> Sets the time for which the validity of the certification path should be determined. If`null`, the current time is used. Note that the`Date`supplied here is copied to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setExplicitPolicyRequired](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setExplicitPolicyRequired(kotlin.Boolean))`(`val:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Sets the ExplicitPolicyRequired flag. If this flag is true, an acceptable policy needs to be explicitly identified in every certificate. By default, the ExplicitPolicyRequired flag is false. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setInitialPolicies](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setInitialPolicies(kotlin.collections.MutableSet))`(`initialPolicies:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>!`)` <br /> Sets the`Set`of initial policy identifiers (OID strings), indicating that any one of these policies would be acceptable to the certificate user for the purposes of certification path processing. By default, any policy is acceptable (i.e. all policies), so a user that wants to allow any policy as acceptable does not need to call this method, or can call it with an empty`Set`(or`null`). Note that the`Set`is copied to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setPolicyMappingInhibited](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setPolicyMappingInhibited(kotlin.Boolean))`(`val:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Sets the PolicyMappingInhibited flag. If this flag is true, policy mapping is inhibited. By default, policy mapping is not inhibited (the flag is false). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setPolicyQualifiersRejected](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setPolicyQualifiersRejected(kotlin.Boolean))`(`qualifiersRejected:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Sets the PolicyQualifiersRejected flag. If this flag is true, certificates that include policy qualifiers in a certificate policies extension that is marked critical are rejected. If the flag is false, certificates are not rejected on this basis. When a`PKIXParameters`object is created, this flag is set to true. This setting reflects the most common (and simplest) strategy for processing policy qualifiers. Applications that want to use a more sophisticated policy must set this flag to false. Note that the PKIX certification path validation algorithm specifies that any policy qualifier in a certificate policies extension that is marked critical must be processed and validated. Otherwise the certification path must be rejected. If the policyQualifiersRejected flag is set to false, it is up to the application to validate all policy qualifiers in this manner in order to be PKIX compliant. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setRevocationEnabled](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setRevocationEnabled(kotlin.Boolean))`(`val:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` <br /> Sets the RevocationEnabled flag. If this flag is true, the default revocation checking mechanism of the underlying PKIX service provider will be used. If this flag is false, the default revocation checking mechanism will be disabled (not used). When a`PKIXParameters`object is created, this flag is set to true. This setting reflects the most common strategy for checking revocation, since each service provider must support revocation checking to be PKIX compliant. Sophisticated applications should set this flag to false when it is not practical to use a PKIX service provider's default revocation checking mechanism or when an alternative revocation checking mechanism is to be substituted (by also calling the[addCertPathChecker](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#addCertPathChecker(java.security.cert.PKIXCertPathChecker))or[setCertPathCheckers](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setCertPathCheckers(kotlin.collections.MutableList))methods). <br />                                                                                                                                                                                                                                                                                                                                                                                | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setSigProvider](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setSigProvider(kotlin.String))`(`sigProvider:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` <br /> Sets the signature provider's name. The specified provider will be preferred when creating[Signature](https://developer.android.com/reference/kotlin/java/security/Signature.html#)objects. If`null`or not set, the first provider found supporting the algorithm will be used. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setTargetCertConstraints](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setTargetCertConstraints(java.security.cert.CertSelector))`(`selector:` `[CertSelector](https://developer.android.com/reference/kotlin/java/security/cert/CertSelector)!`)` <br /> Sets the required constraints on the target certificate. The constraints are specified as an instance of`CertSelector`. If`null`, no constraints are defined. Note that the`CertSelector`specified is cloned to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                            | [setTrustAnchors](https://developer.android.com/reference/kotlin/java/security/cert/PKIXParameters#setTrustAnchors(kotlin.collections.MutableSet))`(`trustAnchors:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[TrustAnchor](https://developer.android.com/reference/kotlin/java/security/cert/TrustAnchor)!>!`)` <br /> Sets the`Set`of most-trusted CAs. Note that the`Set`is copied to protect against subsequent modifications. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | ||

## Public constructors

### PKIXBuilderParameters

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
PKIXBuilderParameters(
    keystore: KeyStore!, 
    targetConstraints: CertSelector!)
```

Creates an instance of`PKIXBuilderParameters`that populates the set of most-trusted CAs from the trusted certificate entries contained in the specified`KeyStore`. Only keystore entries that contain trusted`X509Certificate`s are considered; all other certificate types are ignored.

|                                                                                        Parameters                                                                                        ||
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `keystore`          | [KeyStore](https://developer.android.com/reference/kotlin/java/security/KeyStore.html#)!:a`KeyStore`from which the set of most-trusted CAs will be populated        |
| `targetConstraints` | [CertSelector](https://developer.android.com/reference/kotlin/java/security/cert/CertSelector)!:a`CertSelector`specifying the constraints on the target certificate |

|                                                       Exceptions                                                        ||
|----------------------------------------------------|---------------------------------------------------------------------|
| `java.security.KeyStoreException`                  | if`keystore`has not been initialized                                |
| `java.security.InvalidAlgorithmParameterException` | if`keystore`does not contain at least one trusted certificate entry |
| `java.lang.NullPointerException`                   | if`keystore`is`null`                                                |

### PKIXBuilderParameters

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
PKIXBuilderParameters(
    trustAnchors: MutableSet<TrustAnchor!>!, 
    targetConstraints: CertSelector!)
```

Creates an instance of`PKIXBuilderParameters`with the specified`Set`of most-trusted CAs. Each element of the set is a[TrustAnchor](https://developer.android.com/reference/kotlin/java/security/cert/TrustAnchor).

Note that the`Set`is copied to protect against subsequent modifications.

|                                                                                                                     Parameters                                                                                                                      ||
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `trustAnchors`      | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[TrustAnchor](https://developer.android.com/reference/kotlin/java/security/cert/TrustAnchor)!\>!:a`Set`of`TrustAnchor`s |
| `targetConstraints` | [CertSelector](https://developer.android.com/reference/kotlin/java/security/cert/CertSelector)!:a`CertSelector`specifying the constraints on the target certificate                                                            |

|                                                                 Exceptions                                                                 ||
|----------------------------------------------------|----------------------------------------------------------------------------------------|
| `java.security.InvalidAlgorithmParameterException` | if`trustAnchors`is empty`(trustAnchors.isEmpty() == true)`                             |
| `java.lang.NullPointerException`                   | if`trustAnchors`is`null`                                                               |
| `java.lang.ClassCastException`                     | if any of the elements of`trustAnchors`are not of type`java.security.cert.TrustAnchor` |

## Public methods

### getMaxPathLength

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getMaxPathLength(): Int
```

Returns the value of the maximum number of intermediate non-self-issued certificates that may exist in a certification path. See the[setMaxPathLength](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#setMaxPathLength(kotlin.Int))method for more details.

|                                                                                                     Return                                                                                                     ||
|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the maximum number of non-self-issued intermediate certificates that may exist in a certification path, or -1 if there is no limit |

**See Also**

- [#setMaxPathLength](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#setMaxPathLength(kotlin.Int))  

### setMaxPathLength

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun setMaxPathLength(maxPathLength: Int): Unit
```

Sets the value of the maximum number of non-self-issued intermediate certificates that may exist in a certification path. A certificate is self-issued if the DNs that appear in the subject and issuer fields are identical and are not empty. Note that the last certificate in a certification path is not an intermediate certificate, and is not included in this limit. Usually the last certificate is an end entity certificate, but it can be a CA certificate. A PKIX`CertPathBuilder`instance must not build paths longer than the length specified.

A value of 0 implies that the path can only contain a single certificate. A value of -1 implies that the path length is unconstrained (i.e. there is no maximum). The default maximum path length, if not specified, is 5. Setting a value less than -1 will cause an exception to be thrown.

If any of the CA certificates contain the`BasicConstraintsExtension`, the value of the`pathLenConstraint`field of the extension overrides the maximum path length parameter whenever the result is a certification path of smaller length.

|                                                                                             Parameters                                                                                             ||
|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `maxPathLength` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the maximum number of non-self-issued intermediate certificates that may exist in a certification path |

|                                         Exceptions                                         ||
|-------------------------------------------|-------------------------------------------------|
| `java.security.InvalidParameterException` | if`maxPathLength`is set to a value less than -1 |

**See Also**

- [#getMaxPathLength](https://developer.android.com/reference/kotlin/java/security/cert/PKIXBuilderParameters#getMaxPathLength())  

### toString

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun toString(): String
```

Returns a formatted string describing the parameters.

|                                                             Return                                                             ||
|----------------------------------------------------------------------------------|----------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a formatted string describing the parameters |