APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.provider.certpath

public Class X509CertPath

extends CertPath
Class Inheritance
Imports
java.io.*, java.security.cert.CertificateEncodingException, .Certificate, .CertificateException, .CertificateFactory, .CertPath, .X509Certificate, java.util.*, sun.security.pkcs.ContentInfo, .PKCS7, .SignerInfo, sun.security.x509.AlgorithmId, sun.security.util.DerValue, .DerOutputStream, .DerInputStream

A CertPath (certification path) consisting exclusively of X509Certificates.

By convention, X.509 CertPaths are stored from target to trust anchor. That is, the issuer of one certificate is the subject of the following one. However, unvalidated X.509 CertPaths may not follow this convention. PKIX CertPathValidators will detect any departure from this convention and throw a CertPathValidatorException.

Author
Yassir Elley
Since
1.4

Field Summary

Modifier and TypeField and Description
private final List<X509Certificate>
certs

List of certificates in this chain

private static final String
COUNT_ENCODING

The names of our encodings.

private static final Collection<String>
encodingList

List of supported encodings

private static final String
private static final String
private static final long

Constructor Summary

AccessConstructor and Description
public
X509CertPath(List<? extends Certificate>
a List of X509Certificates
certs
)

Creates an X509CertPath from a List of X509Certificates.

public
X509CertPath(InputStream
the InputStream to read the data from
is
)

Creates an X509CertPath, reading the encoded form from an InputStream.

public
X509CertPath(InputStream
the InputStream to read the data from
is
,
String
the encoding used
encoding
)

Creates an X509CertPath, reading the encoded form from an InputStream.

Method Summary

Modifier and TypeMethod and Description
private byte[]

Returns:

a byte array containing the binary encoding of the PKCS#7 object
encodePKCS7
()

Encode the CertPath using PKCS#7 format.

private byte[]

Returns:

a byte array containing the binary encoding of the PkiPath object
encodePKIPATH
()

Encode the CertPath using PKIPATH format.

public List<X509Certificate>

Returns:

an immutable List of X509Certificates (may be empty, but not null)
getCertificates
()

Implements abstract java.security.cert.CertPath.getCertificates.

Returns the list of certificates in this certification path.

public byte[]

Returns:

the encoded bytes
getEncoded
()

Implements abstract java.security.cert.CertPath.getEncoded.

Returns the encoded form of this certification path, using the default encoding.

public byte[]

Returns:

the encoded bytes
getEncoded
(String
the name of the encoding to use
encoding
)

Implements abstract java.security.cert.CertPath.getEncoded.

Returns the encoded form of this certification path, using the specified encoding.

public Iterator<String>

Returns:

an Iterator over the names of the supported encodings (as Strings)
getEncodings
()

Implements abstract java.security.cert.CertPath.getEncodings.

Returns an iteration of the encodings supported by this certification path, with the default encoding first.

public static Iterator<String>

Returns:

an Iterator over the names of the supported encodings (as Strings)
getEncodingsStatic
()

Returns the encodings supported by this certification path, with the default encoding first.

private static List<X509Certificate>

Returns:

an unmodifiable List of the certificates
parsePKCS7
(InputStream
the InputStream to read the data from
is
)

Parse a PKCS#7 format CertPath from an InputStream.

private static List<X509Certificate>

Returns:

an unmodifiable List of the certificates
parsePKIPATH
(InputStream
the InputStream to read the data from
is
)

Parse a PKIPATH format CertPath from an InputStream.

private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
stream
)

Restores the state of this object from the stream.

Inherited from java.security.cert.CertPath:
equalsgetTypehashCodetoStringwriteReplace

Field Detail

certsback to summary
private final List<X509Certificate> certs

List of certificates in this chain

Annotations
@SuppressWarnings:serial
COUNT_ENCODINGback to summary
private static final String COUNT_ENCODING

The names of our encodings. PkiPath is the default.

encodingListback to summary
private static final Collection<String> encodingList

List of supported encodings

PKCS7_ENCODINGback to summary
private static final String PKCS7_ENCODING
PKIPATH_ENCODINGback to summary
private static final String PKIPATH_ENCODING
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.cert.CertPath.serialVersionUID.

Annotations
@Serial

Constructor Detail

X509CertPathback to summary
public X509CertPath(List<? extends Certificate> certs) throws CertificateException

Creates an X509CertPath from a List of X509Certificates.

The certificates are copied out of the supplied List object.

Parameters
certs:List<? extends Certificate>

a List of X509Certificates

Annotations
@SuppressWarnings:unchecked
Exceptions
CertificateException:
if certs contains an element that is not an X509Certificate
X509CertPathback to summary
public X509CertPath(InputStream is) throws CertificateException

Creates an X509CertPath, reading the encoded form from an InputStream. The data is assumed to be in the default encoding.

Parameters
is:InputStream

the InputStream to read the data from

Exceptions
CertificateException:
if an exception occurs while decoding
X509CertPathback to summary
public X509CertPath(InputStream is, String encoding) throws CertificateException

Creates an X509CertPath, reading the encoded form from an InputStream. The data is assumed to be in the specified encoding.

Parameters
is:InputStream

the InputStream to read the data from

encoding:String

the encoding used

Exceptions
CertificateException:
if an exception occurs while decoding or the encoding requested is not supported

Method Detail

encodePKCS7back to summary
private byte[] encodePKCS7() throws CertificateEncodingException

Encode the CertPath using PKCS#7 format.

Returns:byte[]

a byte array containing the binary encoding of the PKCS#7 object

Exceptions
CertificateEncodingException:
if an exception occurs
encodePKIPATHback to summary
private byte[] encodePKIPATH() throws CertificateEncodingException

Encode the CertPath using PKIPATH format.

Returns:byte[]

a byte array containing the binary encoding of the PkiPath object

Exceptions
CertificateEncodingException:
if an exception occurs
getCertificatesback to summary
public List<X509Certificate> getCertificates()

Implements abstract java.security.cert.CertPath.getCertificates.

Returns the list of certificates in this certification path. The List returned must be immutable and thread-safe.

Returns:List<X509Certificate>

an immutable List of X509Certificates (may be empty, but not null)

Annotations
@Override
getEncodedback to summary
public byte[] getEncoded() throws CertificateEncodingException

Implements abstract java.security.cert.CertPath.getEncoded.

Returns the encoded form of this certification path, using the default encoding.

Returns:byte[]

the encoded bytes

Annotations
@Override
Exceptions
CertificateEncodingException:
if an encoding error occurs
getEncodedback to summary
public byte[] getEncoded(String encoding) throws CertificateEncodingException

Implements abstract java.security.cert.CertPath.getEncoded.

Returns the encoded form of this certification path, using the specified encoding.

Parameters
encoding:String

the name of the encoding to use

Returns:byte[]

the encoded bytes

Annotations
@Override
Exceptions
CertificateEncodingException:
if an encoding error occurs or the encoding requested is not supported
getEncodingsback to summary
public Iterator<String> getEncodings()

Implements abstract java.security.cert.CertPath.getEncodings.

Returns an iteration of the encodings supported by this certification path, with the default encoding first.

Attempts to modify the returned Iterator via its remove method result in an UnsupportedOperationException.

Returns:Iterator<String>

an Iterator over the names of the supported encodings (as Strings)

Annotations
@Override
getEncodingsStaticback to summary
public static Iterator<String> getEncodingsStatic()

Returns the encodings supported by this certification path, with the default encoding first.

Returns:Iterator<String>

an Iterator over the names of the supported encodings (as Strings)

parsePKCS7back to summary
private static List<X509Certificate> parsePKCS7(InputStream is) throws CertificateException

Parse a PKCS#7 format CertPath from an InputStream. Return an unmodifiable List of the certificates.

Parameters
is:InputStream

the InputStream to read the data from

Returns:List<X509Certificate>

an unmodifiable List of the certificates

Exceptions
CertificateException:
if an exception occurs
parsePKIPATHback to summary
private static List<X509Certificate> parsePKIPATH(InputStream is) throws CertificateException

Parse a PKIPATH format CertPath from an InputStream. Return an unmodifiable List of the certificates.

Parameters
is:InputStream

the InputStream to read the data from

Returns:List<X509Certificate>

an unmodifiable List of the certificates

Exceptions
CertificateException:
if an exception occurs
readObjectback to summary
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException

Restores the state of this object from the stream.

Deserialization of this object is not supported.

Parameters
stream:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded