Package java.security.cert
Class CertPathValidator
- java.lang.Object
-
- java.security.cert.CertPathValidator
-
public class CertPathValidator extends Object
This class provides the functionality for validating certification paths (certificate chains) establishing a trust chain from a certificate to a trust anchor.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCertPathValidator(CertPathValidatorSpi validatorSpi, Provider provider, String algorithm)Creates a newCertPathValidatorinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAlgorithm()Returns the certification path algorithm name.static StringgetDefaultType()Returns the defaultCertPathValidatortype from the Security Properties.static CertPathValidatorgetInstance(String algorithm)Returns a new certification path validator for the specified algorithm.static CertPathValidatorgetInstance(String algorithm, String provider)Returns a new certification path validator for the specified algorithm from the specified provider.static CertPathValidatorgetInstance(String algorithm, Provider provider)Returns a new certification path validator for the specified algorithm from the specified provider.ProvidergetProvider()Returns the security provider.CertPathValidatorResultvalidate(CertPath certPath, CertPathParameters params)Validates theCertPathwith the algorithm of thisCertPathValidatorusing the specified algorithm parameters.
-
-
-
Constructor Detail
-
CertPathValidator
protected CertPathValidator(CertPathValidatorSpi validatorSpi, Provider provider, String algorithm)
Creates a newCertPathValidatorinstance.- Parameters:
validatorSpi- the implementation delegate.provider- the security provider.algorithm- the name of the algorithm.
-
-
Method Detail
-
getAlgorithm
public final String getAlgorithm()
Returns the certification path algorithm name.- Returns:
- the certification path algorithm name.
-
getProvider
public final Provider getProvider()
Returns the security provider.- Returns:
- the provider.
-
getInstance
public static CertPathValidator getInstance(String algorithm) throws NoSuchAlgorithmException
Returns a new certification path validator for the specified algorithm.- Parameters:
algorithm- the algorithm name.- Returns:
- a certification path validator for the requested algorithm.
- Throws:
NoSuchAlgorithmException- if no installed provider provides the specified algorithm.NullPointerException- if algorithm isnull.
-
getInstance
public static CertPathValidator getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException
Returns a new certification path validator for the specified algorithm from the specified provider.- Parameters:
algorithm- the algorithm name.provider- the security provider name.- Returns:
- a certification path validator for the requested algorithm.
- Throws:
NoSuchAlgorithmException- if the specified security provider cannot provide the requested algorithm.NoSuchProviderException- if no provider with the specified name can be found.NullPointerException- if algorithm isnull.IllegalArgumentException- ifprovider == null || provider.isEmpty()
-
getInstance
public static CertPathValidator getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException
Returns a new certification path validator for the specified algorithm from the specified provider. Theprovidersupplied does not have to be registered.- Parameters:
algorithm- the algorithm name.provider- the security provider name.- Returns:
- a certification path validator for the requested algorithm.
- Throws:
NoSuchAlgorithmException- if the specified provider cannot provide the requested algorithm.IllegalArgumentException- ifprovider == nullNullPointerException- if algorithm isnull.
-
validate
public final CertPathValidatorResult validate(CertPath certPath, CertPathParameters params) throws CertPathValidatorException, InvalidAlgorithmParameterException
Validates theCertPathwith the algorithm of thisCertPathValidatorusing the specified algorithm parameters.- Parameters:
certPath- the certification path to be validated.params- the certification path validator algorithm parameters.- Returns:
- the validation result.
- Throws:
CertPathValidatorException- if the validation fails, or the algorithm of the specified certification path cannot be validated using the algorithm of this instance.InvalidAlgorithmParameterException- if the specified algorithm parameters cannot be used with this algorithm.- See Also:
CertPathValidatorResult
-
getDefaultType
public static final String getDefaultType()
Returns the defaultCertPathValidatortype from the Security Properties.- Returns:
- the default
CertPathValidatortype from the Security Properties, or the string"PKIX"if it cannot be determined.
-
-