3909N/A * Copyright (c) 2000, 2011, 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 * A class for building certification paths (also known as certificate chains). 0N/A * This class uses a provider-based architecture. 0N/A * To create a <code>CertPathBuilder</code>, call 0N/A * one of the static <code>getInstance</code> methods, passing in the 0N/A * algorithm name of the <code>CertPathBuilder</code> desired and optionally 0N/A * the name of the provider desired. 0N/A * Once a <code>CertPathBuilder</code> object has been created, certification 0N/A * paths can be constructed by calling the {@link #build build} method and 0N/A * passing it an algorithm-specific set of parameters. If successful, the 0N/A * result (including the <code>CertPath</code> that was built) is returned 0N/A * in an object that implements the <code>CertPathBuilderResult</code> 3465N/A * <p> Every implementation of the Java platform is required to support the 3465N/A * following standard <code>CertPathBuilder</code> algorithm: 3465N/A * This algorithm is described in the <a href= 3465N/A * CertPathBuilder section</a> of the 3465N/A * Java Cryptography Architecture Standard Algorithm Name Documentation. 3465N/A * Consult the release documentation for your implementation to see if any 3465N/A * other algorithms are supported. 0N/A * <b>Concurrent Access</b> 0N/A * The static methods of this class are guaranteed to be thread-safe. 0N/A * Multiple threads may concurrently invoke the static methods defined in 0N/A * this class with no ill effects. 0N/A * However, this is not true for the non-static methods defined by this class. 0N/A * Unless otherwise documented by a specific provider, threads that need to 0N/A * access a single <code>CertPathBuilder</code> instance concurrently should 0N/A * synchronize amongst themselves and provide the necessary locking. Multiple 0N/A * threads each manipulating a different <code>CertPathBuilder</code> instance 0N/A * need not synchronize. 0N/A * @author Sean Mullan 0N/A * @author Yassir Elley 0N/A * Constant to lookup in the Security properties file to determine 0N/A * the default certpathbuilder type. In the Security properties file, 0N/A * the default certpathbuilder type is given as: 0N/A * certpathbuilder.type=PKIX 0N/A * Creates a <code>CertPathBuilder</code> object of the given algorithm, 0N/A * and encapsulates the given provider implementation (SPI object) in it. 0N/A * @param builderSpi the provider implementation 0N/A * @param provider the provider 0N/A * @param algorithm the algorithm name 0N/A * Returns a <code>CertPathBuilder</code> object that implements the 0N/A * specified algorithm. 0N/A * <p> This method traverses the list of registered security Providers, 0N/A * starting with the most preferred Provider. 0N/A * A new CertPathBuilder object encapsulating the 0N/A * CertPathBuilderSpi implementation from the first 0N/A * Provider that supports the specified algorithm is returned. 0N/A * <p> Note that the list of registered providers may be retrieved via 0N/A * the {@link Security#getProviders() Security.getProviders()} method. 0N/A * @param algorithm the name of the requested <code>CertPathBuilder</code> 3465N/A * algorithm. See the CertPathBuilder section in the <a href= 3465N/A * Java Cryptography Architecture Standard Algorithm Name Documentation</a> 3465N/A * for information about standard algorithm names. 0N/A * @return a <code>CertPathBuilder</code> object that implements the 0N/A * specified algorithm. 0N/A * @throws NoSuchAlgorithmException if no Provider supports a 0N/A * CertPathBuilderSpi implementation for the 0N/A * specified algorithm. 0N/A * @see java.security.Provider 0N/A * Returns a <code>CertPathBuilder</code> object that implements the 0N/A * specified algorithm. 0N/A * <p> A new CertPathBuilder object encapsulating the 0N/A * CertPathBuilderSpi implementation from the specified provider 0N/A * is returned. The specified provider must be registered 0N/A * in the security provider list. 0N/A * <p> Note that the list of registered providers may be retrieved via 0N/A * the {@link Security#getProviders() Security.getProviders()} method. 0N/A * @param algorithm the name of the requested <code>CertPathBuilder</code> 3465N/A * algorithm. See the CertPathBuilder section in the <a href= 3465N/A * Java Cryptography Architecture Standard Algorithm Name Documentation</a> 3465N/A * for information about standard algorithm names. 0N/A * @param provider the name of the provider. 0N/A * @return a <code>CertPathBuilder</code> object that implements the 0N/A * specified algorithm. 0N/A * @throws NoSuchAlgorithmException if a CertPathBuilderSpi 0N/A * implementation for the specified algorithm is not 0N/A * available from the specified provider. 0N/A * @throws NoSuchProviderException if the specified provider is not 0N/A * registered in the security provider list. 0N/A * @exception IllegalArgumentException if the <code>provider</code> is 0N/A * @see java.security.Provider 0N/A * Returns a <code>CertPathBuilder</code> object that implements the 0N/A * specified algorithm. 0N/A * <p> A new CertPathBuilder object encapsulating the 0N/A * CertPathBuilderSpi implementation from the specified Provider 0N/A * object is returned. Note that the specified Provider object 0N/A * does not have to be registered in the provider list. 0N/A * @param algorithm the name of the requested <code>CertPathBuilder</code> 3465N/A * algorithm. See the CertPathBuilder section in the <a href= 3465N/A * Java Cryptography Architecture Standard Algorithm Name Documentation</a> 3465N/A * for information about standard algorithm names. 0N/A * @param provider the provider. 0N/A * @return a <code>CertPathBuilder</code> object that implements the 0N/A * specified algorithm. 0N/A * @exception NoSuchAlgorithmException if a CertPathBuilderSpi 0N/A * implementation for the specified algorithm is not available 0N/A * from the specified Provider object. 0N/A * @exception IllegalArgumentException if the <code>provider</code> is 0N/A * @see java.security.Provider 0N/A * Returns the provider of this <code>CertPathBuilder</code>. 0N/A * @return the provider of this <code>CertPathBuilder</code> 0N/A * Returns the name of the algorithm of this <code>CertPathBuilder</code>. 0N/A * @return the name of the algorithm of this <code>CertPathBuilder</code> 0N/A * Attempts to build a certification path using the specified algorithm 0N/A * @param params the algorithm parameters 0N/A * @return the result of the build algorithm 0N/A * @throws CertPathBuilderException if the builder is unable to construct 0N/A * a certification path that satisfies the specified parameters 0N/A * @throws InvalidAlgorithmParameterException if the specified parameters 0N/A * are inappropriate for this <code>CertPathBuilder</code> 0N/A * Returns the default <code>CertPathBuilder</code> type as specified in 0N/A * the Java security properties file, or the string "PKIX" 0N/A * if no such property exists. The Java security properties file is 0N/A * <JAVA_HOME> refers to the value of the java.home system property, 0N/A * and specifies the directory where the JRE is installed. 0N/A * <p>The default <code>CertPathBuilder</code> type can be used by 0N/A * applications that do not want to use a hard-coded type when calling one 0N/A * of the <code>getInstance</code> methods, and want to provide a default 0N/A * type in case a user does not specify its own. 0N/A * <p>The default <code>CertPathBuilder</code> type can be changed by 0N/A * setting the value of the "certpathbuilder.type" security property 0N/A * (in the Java security properties file) to the desired type. 0N/A * @return the default <code>CertPathBuilder</code> type as specified 0N/A * in the Java security properties file, or the string "PKIX" 0N/A * if no such property exists.