public class

X509CertPath

extends CertPath
java.lang.Object
   ↳ java.security.cert.CertPath
     ↳ sun.security.provider.certpath.X509CertPath

Class Overview

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.

Summary

Public Constructors
X509CertPath(List<? extends Certificate> certs)
Creates an X509CertPath from a List of X509Certificates.
X509CertPath(InputStream is)
Creates an X509CertPath, reading the encoded form from an InputStream.
X509CertPath(InputStream is, String encoding)
Creates an X509CertPath, reading the encoded form from an InputStream.
Public Methods
List<X509Certificate> getCertificates()
Returns the list of certificates in this certification path.
byte[] getEncoded(String encoding)
Returns the encoded form of this certification path, using the specified encoding.
byte[] getEncoded()
Returns the encoded form of this certification path, using the default encoding.
Iterator<String> getEncodings()
Returns an iteration of the encodings supported by this certification path, with the default encoding first.
static Iterator<String> getEncodingsStatic()
Returns the encodings supported by this certification path, with the default encoding first.
[Expand]
Inherited Methods
From class java.security.cert.CertPath
From class java.lang.Object

Public Constructors

public X509CertPath (List<? extends Certificate> certs)

Creates an X509CertPath from a List of X509Certificates.

The certificates are copied out of the supplied List object.

Parameters
certs a List of X509Certificates
Throws
CertificateException if certs contains an element that is not an X509Certificate

public X509CertPath (InputStream is)

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

Parameters
is the InputStream to read the data from
Throws
CertificateException if an exception occurs while decoding

public X509CertPath (InputStream is, String encoding)

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

Parameters
is the InputStream to read the data from
encoding the encoding used
Throws
CertificateException if an exception occurs while decoding or the encoding requested is not supported

Public Methods

public List<X509Certificate> getCertificates ()

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

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

public byte[] getEncoded (String encoding)

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

Parameters
encoding the name of the encoding to use
Returns
  • the encoded bytes
Throws
CertificateEncodingException if an encoding error occurs or the encoding requested is not supported

public byte[] getEncoded ()

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

Returns
  • the encoded bytes
Throws
CertificateEncodingException if an encoding error occurs

public Iterator<String> 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
  • an Iterator over the names of the supported encodings (as Strings)

public static Iterator<String> getEncodingsStatic ()

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

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