to top
Android APIs
public class

CertPathValidator

extends Object
java.lang.Object
   ↳ java.security.cert.CertPathValidator

Class Overview

This class provides the functionality for validating certification paths (certificate chains) establishing a trust chain from a certificate to a trust anchor.

Summary

Protected Constructors
CertPathValidator(CertPathValidatorSpi validatorSpi, Provider provider, String algorithm)
Creates a new CertPathValidator instance.
Public Methods
final String getAlgorithm()
Returns the certification path algorithm name.
final static String getDefaultType()
Returns the default CertPathValidator type from the Security Properties.
static CertPathValidator getInstance(String algorithm, String provider)
Returns a new certification path validator for the specified algorithm from the specified provider.
static CertPathValidator getInstance(String algorithm, Provider provider)
Returns a new certification path validator for the specified algorithm from the specified provider.
static CertPathValidator getInstance(String algorithm)
Returns a new certification path validator for the specified algorithm.
final Provider getProvider()
Returns the security provider.
final CertPathValidatorResult validate(CertPath certPath, CertPathParameters params)
Validates the CertPath with the algorithm of this CertPathValidator using the specified algorithm parameters.
[Expand]
Inherited Methods
From class java.lang.Object

Protected Constructors

protected CertPathValidator (CertPathValidatorSpi validatorSpi, Provider provider, String algorithm)

Since: API Level 1

Creates a new CertPathValidator instance.

Parameters
validatorSpi the implementation delegate.
provider the security provider.
algorithm the name of the algorithm.

Public Methods

public final String getAlgorithm ()

Since: API Level 1

Returns the certification path algorithm name.

Returns
  • the certification path algorithm name.

public static final String getDefaultType ()

Since: API Level 1

Returns the default CertPathValidator type from the Security Properties.

Returns
  • the default CertPathValidator type from the Security Properties, or the string "PKIX" if it cannot be determined.

public static CertPathValidator getInstance (String algorithm, String provider)

Since: API Level 1

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 is null.
IllegalArgumentException if provider == null || provider.isEmpty()

public static CertPathValidator getInstance (String algorithm, Provider provider)

Since: API Level 1

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 provider cannot provide the requested algorithm.
IllegalArgumentException if provider == null
NullPointerException if algorithm is null.

public static CertPathValidator getInstance (String algorithm)

Since: API Level 1

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 is null.

public final Provider getProvider ()

Since: API Level 1

Returns the security provider.

Returns
  • the provider.

public final CertPathValidatorResult validate (CertPath certPath, CertPathParameters params)

Since: API Level 1

Validates the CertPath with the algorithm of this CertPathValidator using 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.