CertPathBuilder
attempts to build a certification path from a specified certificate
to a trust anchor. Unlike the
CertificateFactory.generateCertPath( ) method,
which might be used by a server to parse a certificate chain
presented to it by a client, this class is used to create a new
certificate chain, and might be used by a client that needs to send a
certificate chain to a server. The CertPathBuilder
API is provider-based, and is algorithm independent, although the use
of any algorithms other than the
"PKIX" standards (which work with
X.509 certificate chains) require appropriate external
implementations of CertPathParameters and
CertPathBuilderResult.
Obtain a CertPathBuilder object by calling one of
the static getInstance( ) methods, specifying the
desired algorithm and, optionally, the desired provider. The
"PKIX" algorithm is the only one
supported by the default "SUN"
provider, and is the only one that has the required
algorithm-specific classes defined by this package. Once you have a
CertPathBuilder, you create a
CertPath object by passing a
CertPathParameters object to the build(
) method.
CertPathParameters is a marker interfaces that
defines no method of its own, so you must use an algorithm-specific
implementation such as PKIXBuilderParameters to
supply the information required to build a
CertPath. The build( ) method
returns a CertPathBuilderResult object. Use the
getCertPath( ) method of this returned object to
obtain the CertPath that was built. The
algorithm-specific implementation
PKIXCertPathBuilderResult has additional methods
that return further algorithm-specific results.
public class CertPathBuilder {
// Protected Constructors
protected CertPathBuilder(CertPathBuilderSpi builderSpi,
java.security.Provider provider, String algorithm);
// Public Class Methods
public static final String getDefaultType( );
public static CertPathBuilder getInstance(String algorithm)
throws java.security.NoSuchAlgorithmException;
public static CertPathBuilder getInstance(String algorithm, String provider)
throws java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException;
public static CertPathBuilder getInstance(String algorithm,
java.security.Provider provider)
throws java.security.NoSuchAlgorithmException;
// Public Instance Methods
public final CertPathBuilderResult build(CertPathParameters params)
throws CertPathBuilderException,
java.security.InvalidAlgorithmParameterException;
public final String getAlgorithm( );
public final java.security.Provider getProvider( );
}