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, {@link #validate(java.security.cert.CertPath,java.security.cert.CertPathParameters)}, which takes provider-specific implementations of {@link CertPathParameters}, and return provider-specific implementations of {@link CertPathValidatorResult}.

Since: JDK 1.4

See Also: CertPath

Constructor Summary
protected CertPathValidator(CertPathValidatorSpi validatorSpi, Provider provider, String algorithm)
Creates a new CertPathValidator.
Method Summary
StringgetAlgorithm()
Return the name of this validator.
static StringgetDefaultType()
Returns the default validator type.
static CertPathValidatorgetInstance(String algorithm)
Returns an instance of the given validator from the first provider that implements it.
static CertPathValidatorgetInstance(String algorithm, String provider)
Returns an instance of the given validator from the named provider.
static CertPathValidatorgetInstance(String algorithm, Provider provider)
Returns an instance of the given validator from the given provider.
ProvidergetProvider()
Return the provider of this implementation.
CertPathValidatorResultvalidate(CertPath certPath, CertPathParameters params)
Attempt to validate a certificate path.

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

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)
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)
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)
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)
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.