Package java.security.cert
Class CertPathBuilder
java.lang.Object
java.security.cert.CertPathBuilder
public class CertPathBuilder extends Object
This class implements the functionality of a builder for an unverified
Certification Paths from a specified certificate to a trust anchor.
-
Constructor Summary
Constructors Modifier Constructor Description protectedCertPathBuilder(CertPathBuilderSpi builderSpi, Provider provider, String algorithm)Creates a newCertPathBuilder. -
Method Summary
Modifier and Type Method Description CertPathBuilderResultbuild(CertPathParameters params)Builds a certification path with the specified algorithm parameters.StringgetAlgorithm()Returns the algorithm name of this instance.static StringgetDefaultType()Returns the defaultCertPathBuildertype from the Security Properties.static CertPathBuildergetInstance(String algorithm)Creates a newCertPathBuilderinstance with the specified algorithm.static CertPathBuildergetInstance(String algorithm, String provider)Creates a newCertPathBuilderinstance from the specified provider providing the specified algorithm.static CertPathBuildergetInstance(String algorithm, Provider provider)Creates a newCertPathBuilderinstance from the specified provider providing the specified algorithm.ProvidergetProvider()Returns the provider of this instance.
-
Constructor Details
-
CertPathBuilder
Creates a newCertPathBuilder.- Parameters:
builderSpi- the implementation delegate.provider- the provider.algorithm- the desired algorithm available at the provider.
-
-
Method Details
-
getAlgorithm
Returns the algorithm name of this instance.- Returns:
- the algorithm name of this instance.
-
getProvider
Returns the provider of this instance.- Returns:
- the provider of this instance.
-
getInstance
Creates a newCertPathBuilderinstance with the specified algorithm.- Parameters:
algorithm- the name of the algorithm.- Returns:
- a builder for the requested algorithm.
- Throws:
NullPointerException- if the algorithm isnull.NoSuchAlgorithmException- if no installed provider can provide the algorithm.
-
getInstance
public static CertPathBuilder getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderExceptionCreates a newCertPathBuilderinstance from the specified provider providing the specified algorithm.- Parameters:
algorithm- the name of the algorithm.provider- the name of the provider.- Returns:
- a builder for the requested algorithm.
- Throws:
NoSuchAlgorithmException- if the specified provider cannot provide the algorithm.NoSuchProviderException- if no provider with the specified name can be found.NullPointerException- if algorithm isnull.IllegalArgumentException- ifprovider == null || provider.isEmpty()
-
getInstance
public static CertPathBuilder getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmExceptionCreates a newCertPathBuilderinstance from the specified provider providing the specified algorithm.- Parameters:
algorithm- the name of the algorithm.provider- the provider.- Returns:
- a builder for the requested algorithm
- Throws:
NoSuchAlgorithmException- if the specified provider cannot provide the algorithm.IllegalArgumentException- ifprovider == nullNullPointerException- if algorithm isnull.
-
build
public final CertPathBuilderResult build(CertPathParameters params) throws CertPathBuilderException, InvalidAlgorithmParameterExceptionBuilds a certification path with the specified algorithm parameters.- Parameters:
params- the algorithm parameters.- Returns:
- the built certification path.
- Throws:
CertPathBuilderException- if the build fails.InvalidAlgorithmParameterException- if the specified parameters cannot be used to build with this builder.- See Also:
CertPathBuilderResult
-
getDefaultType
Returns the defaultCertPathBuildertype from the Security Properties.- Returns:
- the default
CertPathBuildertype from the Security Properties, or the string "PKIX" if it cannot be determined.
-