java.security.cert

Class CertPathValidator


public class CertPathValidator
extends Object

Generic interface to classes that validate certificate paths.

Using this class is similar to all the provider-based security classes; the method of interest, validate(CertPath,CertPathParameters), which takes provider-specific implementations of CertPathParameters, and return provider-specific implementations of CertPathValidatorResult.

Since:
JDK 1.4
See Also:
CertPath

Constructor Summary

CertPathValidator(CertPathValidatorSpi validatorSpi, Provider provider, String algorithm)
Creates a new CertPathValidator.

Method Summary

String
getAlgorithm()
Return the name of this validator.
static String
getDefaultType()
Returns the default validator type.
static CertPathValidator
getInstance(String algorithm)
Returns an instance of the given validator from the first provider that implements it.
static CertPathValidator
getInstance(String algorithm, String provider)
Returns an instance of the given validator from the named provider.
static CertPathValidator
getInstance(String algorithm, Provider provider)
Returns an instance of the given validator from the given provider.
Provider
getProvider()
Return the provider of this implementation.
CertPathValidatorResult
validate(CertPath certPath, CertPathParameters params)
Attempt to validate a certificate path.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

CertPathValidator

protected CertPathValidator(CertPathValidatorSpi validatorSpi,
                            Provider provider,
                            String algorithm)
Creates a new CertPathValidator.
Parameters:
validatorSpi - The underlying implementation.
provider - The provider of the implementation.
algorithm - The algorithm name.

Method Details

getAlgorithm

public final String getAlgorithm()
Return the name of this validator.
Returns:
This validator's name.

getDefaultType

public static String getDefaultType()
Returns the default validator type.

This value may be set at run-time via the security property "certpathvalidator.type", or the value "PKIX" if this property is not set.

Returns:
The default validator type.

getInstance

public static CertPathValidator getInstance(String algorithm)
            throws NoSuchAlgorithmException
Returns an instance of the given validator from the first provider that implements it.
Parameters:
algorithm - The name of the algorithm to get.
Returns:
The new instance.
Throws:
NoSuchAlgorithmException - If no installed provider implements the requested algorithm.
IllegalArgumentException - if algorithm is null or is an empty string.

getInstance

public static CertPathValidator getInstance(String algorithm,
                                            String provider)
            throws NoSuchAlgorithmException,
                   NoSuchProviderException
Returns an instance of the given validator from the named provider.
Parameters:
algorithm - The name of the algorithm to get.
provider - The name of the provider from which to get the implementation.
Returns:
The new instance.
Throws:
NoSuchAlgorithmException - If the named provider does not implement the algorithm.
NoSuchProviderException - If no provider named provider is installed.
IllegalArgumentException - if either algorithm or provider is null, or if algorithm is an empty string.

getInstance

public static CertPathValidator getInstance(String algorithm,
                                            Provider provider)
            throws NoSuchAlgorithmException
Returns an instance of the given validator from the given provider.
Parameters:
algorithm - The name of the algorithm to get.
provider - The provider from which to get the implementation.
Returns:
The new instance.
Throws:
NoSuchAlgorithmException - If the provider does not implement the algorithm.
IllegalArgumentException - if either algorithm or provider is null, or if algorithm is an empty string.

getProvider

public final Provider getProvider()
Return the provider of this implementation.
Returns:
The provider.

validate

public final CertPathValidatorResult validate(CertPath certPath,
                                              CertPathParameters params)
            throws CertPathValidatorException,
                   InvalidAlgorithmParameterException
Attempt to validate a certificate path.
Parameters:
certPath - The path to validate.
params - The algorithm-specific parameters.
Returns:
The result of this validation attempt.
Throws:
CertPathValidatorException - If the certificate path cannot be validated.
InvalidAlgorithmParameterException - If this implementation rejects the specified parameters.

CertPathValidator -- validates certificate paths. Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.