# PKIXBuilderParameters

public class **PKIXBuilderParameters** extends [PKIXParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html)  
Parameters used as input for the PKIX `CertPathBuilder`
algorithm.


A PKIX `CertPathBuilder` uses these parameters to `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathBuilder.html#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 `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#PKIXBuilderParameters(java.util.Set<java.security.cert.TrustAnchor>,%20java.security.cert.CertSelector)`, specifying a
`Set` of `TrustAnchor` objects, each of which
identifies a most-trusted CA. Alternatively, an application can call
`https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#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.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathBuilder.html`

### Public Constructor Summary

|---|---|
|   | [PKIXBuilderParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#PKIXBuilderParameters(java.util.Set<java.security.cert.TrustAnchor>,%20java.security.cert.CertSelector))([Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[TrustAnchor](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/TrustAnchor.html)\> trustAnchors, [CertSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertSelector.html) targetConstraints) Creates an instance of `PKIXBuilderParameters` with the specified `Set` of most-trusted CAs. |
|   | [PKIXBuilderParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#PKIXBuilderParameters(java.security.KeyStore,%20java.security.cert.CertSelector))([KeyStore](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyStore.html) keystore, [CertSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertSelector.html) targetConstraints) Creates an instance of `PKIXBuilderParameters` that populates the set of most-trusted CAs from the trusted certificate entries contained in the specified `KeyStore`. |

### Public Method Summary

|---|---|
| int | [getMaxPathLength](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#getMaxPathLength())() Returns the value of the maximum number of intermediate non-self-issued certificates that may exist in a certification path. |
| void | [setMaxPathLength](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#setMaxPathLength(int))(int maxPathLength) Sets the value of the maximum number of non-self-issued intermediate certificates that may exist in a certification path. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#toString())() Returns a formatted string describing the parameters. |

### Inherited Method Summary

From class [java.security.cert.PKIXParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html)

|---|---|
| void | [addCertPathChecker](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#addCertPathChecker(java.security.cert.PKIXCertPathChecker))([PKIXCertPathChecker](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXCertPathChecker.html) checker) Adds a `PKIXCertPathChecker` to the list of certification path checkers. |
| void | [addCertStore](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#addCertStore(java.security.cert.CertStore))([CertStore](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertStore.html) store) Adds a `CertStore` to the end of the list of `CertStore`s used in finding certificates and CRLs. |
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#clone())() Makes a copy of this `PKIXParameters` object. |
| [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<[PKIXCertPathChecker](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXCertPathChecker.html)\> | [getCertPathCheckers](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getCertPathCheckers())() Returns the `List` of certification path checkers. |
| [List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<[CertStore](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertStore.html)\> | [getCertStores](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getCertStores())() Returns an immutable `List` of `CertStore`s that are used to find certificates and CRLs. |
| [Date](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Date.html) | [getDate](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getDate())() Returns the time for which the validity of the certification path should be determined. |
| [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> | [getInitialPolicies](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getInitialPolicies())() 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. |
| boolean | [getPolicyQualifiersRejected](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getPolicyQualifiersRejected())() Gets the PolicyQualifiersRejected flag. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getSigProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getSigProvider())() Returns the signature provider's name, or `null` if not set. |
| [CertSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertSelector.html) | [getTargetCertConstraints](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getTargetCertConstraints())() Returns the required constraints on the target certificate. |
| [Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[TrustAnchor](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/TrustAnchor.html)\> | [getTrustAnchors](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#getTrustAnchors())() Returns an immutable `Set` of the most-trusted CAs. |
| boolean | [isAnyPolicyInhibited](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#isAnyPolicyInhibited())() Checks whether the any policy OID should be processed if it is included in a certificate. |
| boolean | [isExplicitPolicyRequired](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#isExplicitPolicyRequired())() Checks if explicit policy is required. |
| boolean | [isPolicyMappingInhibited](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#isPolicyMappingInhibited())() Checks if policy mapping is inhibited. |
| boolean | [isRevocationEnabled](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#isRevocationEnabled())() Checks the RevocationEnabled flag. |
| void | [setAnyPolicyInhibited](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setAnyPolicyInhibited(boolean))(boolean val) Sets state to determine if the any policy OID should be processed if it is included in a certificate. |
| void | [setCertPathCheckers](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setCertPathCheckers(java.util.List<java.security.cert.PKIXCertPathChecker>))([List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<[PKIXCertPathChecker](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXCertPathChecker.html)\> checkers) Sets a `List` of additional certification path checkers. |
| void | [setCertStores](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setCertStores(java.util.List<java.security.cert.CertStore>))([List](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/List.html)\<[CertStore](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertStore.html)\> stores) Sets the list of `CertStore`s to be used in finding certificates and CRLs. |
| void | [setDate](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setDate(java.util.Date))([Date](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Date.html) date) Sets the time for which the validity of the certification path should be determined. |
| void | [setExplicitPolicyRequired](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setExplicitPolicyRequired(boolean))(boolean val) Sets the ExplicitPolicyRequired flag. |
| void | [setInitialPolicies](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setInitialPolicies(java.util.Set<java.lang.String>))([Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)\> initialPolicies) 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. |
| void | [setPolicyMappingInhibited](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setPolicyMappingInhibited(boolean))(boolean val) Sets the PolicyMappingInhibited flag. |
| void | [setPolicyQualifiersRejected](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setPolicyQualifiersRejected(boolean))(boolean qualifiersRejected) Sets the PolicyQualifiersRejected flag. |
| void | [setRevocationEnabled](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setRevocationEnabled(boolean))(boolean val) Sets the RevocationEnabled flag. |
| void | [setSigProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setSigProvider(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) sigProvider) Sets the signature provider's name. |
| void | [setTargetCertConstraints](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setTargetCertConstraints(java.security.cert.CertSelector))([CertSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertSelector.html) selector) Sets the required constraints on the target certificate. |
| void | [setTrustAnchors](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#setTrustAnchors(java.util.Set<java.security.cert.TrustAnchor>))([Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[TrustAnchor](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/TrustAnchor.html)\> trustAnchors) Sets the `Set` of most-trusted CAs. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXParameters.html#toString())() Returns a formatted string describing the parameters. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.security.cert.CertPathParameters](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathParameters.html)

|---|---|
| abstract [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathParameters.html#clone())() Makes a copy of this `CertPathParameters`. |

## Public Constructors

#### public
**PKIXBuilderParameters**
([Set](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Set.html)\<[TrustAnchor](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/TrustAnchor.html)\> trustAnchors, [CertSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertSelector.html) targetConstraints)

Creates an instance of `PKIXBuilderParameters` with
the specified `Set` of most-trusted CAs.
Each element of the set is a `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/TrustAnchor.html`.

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

##### Parameters

| trustAnchors | a `Set` of `TrustAnchor`s |
| targetConstraints | a `CertSelector` specifying the constraints on the target certificate |
|---|---|

##### Throws

| [InvalidAlgorithmParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidAlgorithmParameterException.html) | if `trustAnchors` is empty `(trustAnchors.isEmpty() == true)` |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `trustAnchors` is `null` |
| [ClassCastException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/ClassCastException.html) | if any of the elements of `trustAnchors` are not of type `java.security.cert.TrustAnchor` |
|---|---|

#### public
**PKIXBuilderParameters**
([KeyStore](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyStore.html) keystore, [CertSelector](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertSelector.html) targetConstraints)

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 | a `KeyStore` from which the set of most-trusted CAs will be populated |
| targetConstraints | a `CertSelector` specifying the constraints on the target certificate |
|---|---|

##### Throws

| [KeyStoreException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyStoreException.html) | if `keystore` has not been initialized |
| [InvalidAlgorithmParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidAlgorithmParameterException.html) | if `keystore` does not contain at least one trusted certificate entry |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `keystore` is `null` |
|---|---|

## Public Methods

#### public int
**getMaxPathLength**
()

Returns the value of the maximum number of intermediate non-self-issued
certificates that may exist in a certification path. See
the `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#setMaxPathLength(int)` method for more details.

##### Returns

- 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

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#setMaxPathLength(int)`

#### public void
**setMaxPathLength**
(int maxPathLength)

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 | the maximum number of non-self-issued intermediate certificates that may exist in a certification path |
|---|---|

##### Throws

| [InvalidParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidParameterException.html) | if `maxPathLength` is set to a value less than -1 |
|---|---|

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXBuilderParameters.html#getMaxPathLength()`

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns a formatted string describing the parameters.

##### Returns

- a formatted string describing the parameters