This class uses a provider-based architecture.
To create a CertPathBuilder
, call
one of the static getInstance
methods, passing in the
algorithm name of the CertPathBuilder
desired and optionally
the name of the provider desired.
Once a CertPathBuilder
object has been created, certification
paths can be constructed by calling the build
method and
passing it an algorithm-specific set of parameters. If successful, the
result (including the CertPath
that was built) is returned
in an object that implements the CertPathBuilderResult
interface.
The getRevocationChecker
method allows an application to specify
additional algorithm-specific parameters and options used by the
CertPathBuilder
when checking the revocation status of certificates.
Here is an example demonstrating how it is used with the PKIX algorithm:
CertPathBuilder cpb = CertPathBuilder.getInstance("PKIX"); PKIXRevocationChecker rc = (PKIXRevocationChecker)cpb.getRevocationChecker(); rc.setOptions(EnumSet.of(Option.PREFER_CRLS)); params.addCertPathChecker(rc); CertPathBuilderResult cpbr = cpb.build(params);
Every implementation of the Java platform is required to support the
following standard CertPathBuilder
algorithm:
PKIX
Concurrent Access
The static methods of this class are guaranteed to be thread-safe. Multiple threads may concurrently invoke the static methods defined in this class with no ill effects.
However, this is not true for the non-static methods defined by this class.
Unless otherwise documented by a specific provider, threads that need to
access a single CertPathBuilder
instance concurrently should
synchronize amongst themselves and provide the necessary locking. Multiple
threads each manipulating a different CertPathBuilder
instance
need not synchronize.
CertPath
Modifier and Type | Field and Description |
---|---|
private final String | |
private final CertPathBuilderSpi | |
private static final String | |
private final Provider |
Access | Constructor and Description |
---|---|
protected | CertPathBuilder(CertPathBuilderSpi
the provider implementation builderSpi, Provider the provider provider, String the algorithm name algorithm)Creates a |
Modifier and Type | Method and Description |
---|---|
public final CertPathBuilderResult | Returns: the result of the build algorithmthe algorithm parameters params)Attempts to build a certification path using the specified algorithm parameter set. |
public final String | Returns: the name of the algorithm of thisCertPathBuilder Returns the name of the algorithm of this |
public static final String | Returns: the defaultCertPathBuilder type as specified
by the certpathbuilder.type security property, or the string
"PKIX" if no such property exists.Returns the default |
public static CertPathBuilder | Returns: aCertPathBuilder object that implements the
specified algorithmthe name of the requested algorithm)CertPathBuilder
algorithm. See the CertPathBuilder section in the
Java Security Standard Algorithm Names Specification
for information about standard algorithm names.Returns a |
public static CertPathBuilder | Returns: aCertPathBuilder object that implements the
specified algorithmthe name of the requested algorithm, String CertPathBuilder
algorithm. See the CertPathBuilder section in the
Java Security Standard Algorithm Names Specification
for information about standard algorithm names.the name of the provider. provider)Returns a |
public static CertPathBuilder | Returns: aCertPathBuilder object that implements the
specified algorithmthe name of the requested algorithm, Provider CertPathBuilder
algorithm. See the CertPathBuilder section in the
Java Security Standard Algorithm Names Specification
for information about standard algorithm names.the provider. provider)Returns a |
public final Provider | Returns: the provider of thisCertPathBuilder Returns the provider of this |
public final CertPathChecker | Returns: aCertPathChecker Returns a |
algorithm | back to summary |
---|---|
private final String algorithm |
builderSpi | back to summary |
---|---|
private final CertPathBuilderSpi builderSpi |
CPB_TYPE | back to summary |
---|---|
private static final String CPB_TYPE |
provider | back to summary |
---|---|
private final Provider provider |
CertPathBuilder | back to summary |
---|---|
protected CertPathBuilder(CertPathBuilderSpi builderSpi, Provider provider, String algorithm) Creates a
|
build | back to summary |
---|---|
public final CertPathBuilderResult build(CertPathParameters params) throws CertPathBuilderException, InvalidAlgorithmParameterException Attempts to build a certification path using the specified algorithm parameter set.
|
getAlgorithm | back to summary |
---|---|
public final String getAlgorithm() Returns the name of the algorithm of this
|
getDefaultType | back to summary |
---|---|
public static final String getDefaultType() Returns the default The default The default
|
getInstance | back to summary |
---|---|
public static CertPathBuilder getInstance(String algorithm) throws NoSuchAlgorithmException Returns a This method traverses the list of registered security Providers, starting with the most preferred Provider. A new CertPathBuilder object encapsulating the CertPathBuilderSpi implementation from the first Provider that supports the specified algorithm is returned. Note that the list of registered providers may be retrieved via
the Implementation Note The JDK Reference Implementation additionally uses the
|
getInstance | back to summary |
---|---|
public static CertPathBuilder getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException Returns a A new CertPathBuilder object encapsulating the CertPathBuilderSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list. Note that the list of registered providers may be retrieved via
the
|
getInstance | back to summary |
---|---|
public static CertPathBuilder getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException Returns a A new CertPathBuilder object encapsulating the CertPathBuilderSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.
|
getProvider | back to summary |
---|---|
public final Provider getProvider() Returns the provider of this
|
getRevocationChecker | back to summary |
---|---|
public final CertPathChecker getRevocationChecker() Returns a The primary purpose of this method is to allow callers to specify additional input parameters and options specific to revocation checking. See the class description for an example.
|