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 validating certification paths (also known as certificate 0N/A * This class uses a provider-based architecture. 0N/A * To create a <code>CertPathValidator</code>, 0N/A * call one of the static <code>getInstance</code> methods, passing in the 0N/A * algorithm name of the <code>CertPathValidator</code> desired and 0N/A * optionally the name of the provider desired. 0N/A * Once a <code>CertPathValidator</code> object has been created, it can 0N/A * be used to validate certification paths by calling the {@link #validate 0N/A * validate} method and passing it the <code>CertPath</code> to be validated 0N/A * and an algorithm-specific set of parameters. If successful, the result is 0N/A * returned in an object that implements the 0N/A * <code>CertPathValidatorResult</code> interface. 3465N/A * <p> Every implementation of the Java platform is required to support the 3465N/A * following standard <code>CertPathValidator</code> algorithm: 3465N/A * This algorithm is described in the <a href= 3465N/A * CertPathValidator 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>CertPathValidator</code> instance concurrently should 0N/A * synchronize amongst themselves and provide the necessary locking. Multiple 0N/A * threads each manipulating a different <code>CertPathValidator</code> 0N/A * instance need not synchronize. 0N/A * @author Yassir Elley 0N/A * Constant to lookup in the Security properties file to determine 0N/A * the default certpathvalidator type. In the Security properties file, 0N/A * the default certpathvalidator type is given as: 0N/A * certpathvalidator.type=PKIX 0N/A * Creates a <code>CertPathValidator</code> object of the given algorithm, 0N/A * and encapsulates the given provider implementation (SPI object) in it. 0N/A * @param validatorSpi the provider implementation 0N/A * @param provider the provider 0N/A * @param algorithm the algorithm name 0N/A * Returns a <code>CertPathValidator</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 CertPathValidator object encapsulating the 0N/A * CertPathValidatorSpi 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>CertPathValidator</code> 3465N/A * algorithm. See the CertPathValidator 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>CertPathValidator</code> object that implements the 0N/A * specified algorithm. 0N/A * @exception NoSuchAlgorithmException if no Provider supports a 0N/A * CertPathValidatorSpi implementation for the 0N/A * specified algorithm. 0N/A * @see java.security.Provider 0N/A * Returns a <code>CertPathValidator</code> object that implements the 0N/A * specified algorithm. 0N/A * <p> A new CertPathValidator object encapsulating the 0N/A * CertPathValidatorSpi 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>CertPathValidator</code> 3465N/A * algorithm. See the CertPathValidator 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>CertPathValidator</code> object that implements the 0N/A * specified algorithm. 0N/A * @exception NoSuchAlgorithmException if a CertPathValidatorSpi 0N/A * implementation for the specified algorithm is not 0N/A * available from the specified provider. 0N/A * @exception 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>CertPathValidator</code> object that implements the 0N/A * specified algorithm. 0N/A * <p> A new CertPathValidator object encapsulating the 0N/A * CertPathValidatorSpi 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. 3465N/A * @param algorithm the name of the requested <code>CertPathValidator</code> 3465N/A * algorithm. See the CertPathValidator 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>CertPathValidator</code> object that implements the 0N/A * specified algorithm. 0N/A * @exception NoSuchAlgorithmException if a CertPathValidatorSpi 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 <code>Provider</code> of this 0N/A * <code>CertPathValidator</code>. 0N/A * @return the <code>Provider</code> of this <code>CertPathValidator</code> 0N/A * Returns the algorithm name of this <code>CertPathValidator</code>. 0N/A * @return the algorithm name of this <code>CertPathValidator</code> 0N/A * Validates the specified certification path using the specified 0N/A * algorithm parameter set. 0N/A * The <code>CertPath</code> specified must be of a type that is 0N/A * supported by the validation algorithm, otherwise an 0N/A * <code>InvalidAlgorithmParameterException</code> will be thrown. For 0N/A * example, a <code>CertPathValidator</code> that implements the PKIX 0N/A * algorithm validates <code>CertPath</code> objects of type X.509. 0N/A * @param certPath the <code>CertPath</code> to be validated 0N/A * @param params the algorithm parameters 0N/A * @return the result of the validation algorithm 0N/A * @exception CertPathValidatorException if the <code>CertPath</code> 0N/A * @exception InvalidAlgorithmParameterException if the specified 0N/A * parameters or the type of the specified <code>CertPath</code> are 0N/A * inappropriate for this <code>CertPathValidator</code> 0N/A * Returns the default <code>CertPathValidator</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>CertPathValidator</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>CertPathValidator</code> type can be changed by 0N/A * setting the value of the "certpathvalidator.type" security property 0N/A * (in the Java security properties file) to the desired type. 0N/A * @return the default <code>CertPathValidator</code> type as specified 0N/A * in the Java security properties file, or the string "PKIX" 0N/A * if no such property exists.