java.security.cert
Class CertPathValidator

java.lang.Object
  extended by java.security.cert.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(java.security.cert.CertPath,java.security.cert.CertPathParameters), which takes provider-specific implementations of CertPathParameters, and return provider-specific implementations of CertPathValidatorResult.

Since:
JDK 1.4
See Also:
CertPath

Constructor Summary
protected 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, Provider provider)
          Returns an instance of the given validator from the given provider.
static CertPathValidator getInstance(String algorithm, String provider)
          Returns an instance of the given validator from the named 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, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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 Detail

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.

getAlgorithm

public final String getAlgorithm()
Return the name of this validator.

Returns:
This validator's name.

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.