2362N/A * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Parameters used as input for the PKIX <code>CertPathBuilder</code> 0N/A * A PKIX <code>CertPathBuilder</code> uses these parameters to {@link 0N/A * CertPathBuilder#build build} a <code>CertPath</code> which has been 0N/A * validated according to the PKIX certification path validation algorithm. 0N/A * <p>To instantiate a <code>PKIXBuilderParameters</code> object, an 0N/A * application must specify one or more <i>most-trusted CAs</i> as defined by 0N/A * the PKIX certification path validation algorithm. The most-trusted CA 0N/A * can be specified using one of two constructors. An application 0N/A * can call {@link #PKIXBuilderParameters(Set, CertSelector) 0N/A * PKIXBuilderParameters(Set, CertSelector)}, specifying a 0N/A * <code>Set</code> of <code>TrustAnchor</code> objects, each of which 0N/A * identifies a most-trusted CA. Alternatively, an application can call 0N/A * {@link #PKIXBuilderParameters(KeyStore, CertSelector) 0N/A * PKIXBuilderParameters(KeyStore, CertSelector)}, specifying a 0N/A * <code>KeyStore</code> instance containing trusted certificate entries, each 0N/A * of which will be considered as a most-trusted CA. 0N/A * <p>In addition, an application must specify constraints on the target 0N/A * certificate that the <code>CertPathBuilder</code> will attempt 0N/A * to build a path to. The constraints are specified as a 0N/A * <code>CertSelector</code> object. These constraints should provide the 0N/A * <code>CertPathBuilder</code> with enough search criteria to find the target 0N/A * certificate. Minimal criteria for an <code>X509Certificate</code> usually 0N/A * include the subject name and/or one or more subject alternative names. 0N/A * If enough criteria is not specified, the <code>CertPathBuilder</code> 0N/A * may throw a <code>CertPathBuilderException</code>. 0N/A * <b>Concurrent Access</b> 0N/A * Unless otherwise specified, the methods defined in this class are not 0N/A * thread-safe. Multiple threads that need to access a single 0N/A * object concurrently should synchronize amongst themselves and 0N/A * provide the necessary locking. Multiple threads each manipulating 0N/A * separate objects need not synchronize. 0N/A * @see CertPathBuilder 0N/A * @author Sean Mullan 0N/A * Creates an instance of <code>PKIXBuilderParameters</code> with 0N/A * the specified <code>Set</code> of most-trusted CAs. 0N/A * Each element of the set is a {@link TrustAnchor TrustAnchor}. 0N/A * <p>Note that the <code>Set</code> is copied to protect against 0N/A * subsequent modifications. 0N/A * @param trustAnchors a <code>Set</code> of <code>TrustAnchor</code>s 0N/A * @param targetConstraints a <code>CertSelector</code> specifying the 0N/A * constraints on the target certificate 0N/A * @throws InvalidAlgorithmParameterException if <code>trustAnchors</code> 0N/A * is empty <code>(trustAnchors.isEmpty() == true)</code> 0N/A * @throws NullPointerException if <code>trustAnchors</code> is 0N/A * @throws ClassCastException if any of the elements of 0N/A * <code>trustAnchors</code> are not of type 0N/A * <code>java.security.cert.TrustAnchor</code> 0N/A * Creates an instance of <code>PKIXBuilderParameters</code> that 0N/A * populates the set of most-trusted CAs from the trusted 0N/A * certificate entries contained in the specified <code>KeyStore</code>. 0N/A * Only keystore entries that contain trusted <code>X509Certificate</code>s 0N/A * are considered; all other certificate types are ignored. 0N/A * @param keystore a <code>KeyStore</code> from which the set of 0N/A * most-trusted CAs will be populated 0N/A * @param targetConstraints a <code>CertSelector</code> specifying the 0N/A * constraints on the target certificate 0N/A * @throws KeyStoreException if <code>keystore</code> has not been 0N/A * @throws InvalidAlgorithmParameterException if <code>keystore</code> does 0N/A * not contain at least one trusted certificate entry 0N/A * @throws NullPointerException if <code>keystore</code> is 0N/A * Sets the value of the maximum number of non-self-issued intermediate 0N/A * certificates that may exist in a certification path. A certificate 0N/A * is self-issued if the DNs that appear in the subject and issuer 0N/A * fields are identical and are not empty. Note that the last certificate 0N/A * in a certification path is not an intermediate certificate, and is not 0N/A * included in this limit. Usually the last certificate is an end entity 0N/A * certificate, but it can be a CA certificate. A PKIX 0N/A * <code>CertPathBuilder</code> instance must not build 0N/A * paths longer than the length specified. 0N/A * <p> A value of 0 implies that the path can only contain 0N/A * a single certificate. A value of -1 implies that the 0N/A * path length is unconstrained (i.e. there is no maximum). 0N/A * The default maximum path length, if not specified, is 5. 0N/A * Setting a value less than -1 will cause an exception to be thrown. 0N/A * <p> If any of the CA certificates contain the 0N/A * <code>BasicConstraintsExtension</code>, the value of the 0N/A * <code>pathLenConstraint</code> field of the extension overrides 0N/A * the maximum path length parameter whenever the result is a 0N/A * certification path of smaller length. 0N/A * @param maxPathLength the maximum number of non-self-issued intermediate 0N/A * certificates that may exist in a certification path 0N/A * @throws InvalidParameterException if <code>maxPathLength</code> is set 0N/A * to a value less than -1 0N/A * @see #getMaxPathLength 0N/A +
"length parameter can not be less than -1");
0N/A * Returns the value of the maximum number of intermediate non-self-issued 0N/A * certificates that may exist in a certification path. See 0N/A * the {@link #setMaxPathLength} method for more details. 0N/A * @return the maximum number of non-self-issued intermediate certificates 0N/A * that may exist in a certification path, or -1 if there is no limit 0N/A * @see #setMaxPathLength 0N/A * Returns a formatted string describing the parameters. 0N/A * @return a formatted string describing the parameters