sun.security.provider.certpath
Class X509CertPath

java.lang.Object
  extended by java.security.cert.CertPath
      extended by sun.security.provider.certpath.X509CertPath
All Implemented Interfaces:
Serializable

public class X509CertPath
extends CertPath

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.

Since:
1.4
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.security.cert.CertPath
CertPath.CertPathRep
 
Constructor Summary
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.
X509CertPath(List certs)
          Creates an X509CertPath from a List of X509Certificates.
 
Method Summary
 List getCertificates()
          Returns the list of certificates in this certification path.
 byte[] getEncoded()
          Returns the encoded form of this certification path, using the default encoding.
 byte[] getEncoded(String encoding)
          Returns the encoded form of this certification path, using the specified encoding.
 Iterator getEncodings()
          Returns an iteration of the encodings supported by this certification path, with the default encoding first.
static Iterator getEncodingsStatic()
          Returns the encodings supported by this certification path, with the default encoding first.
 
Methods inherited from class java.security.cert.CertPath
equals, getType, hashCode, toString, writeReplace
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

X509CertPath

public X509CertPath(List certs)
             throws CertificateException
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

X509CertPath

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 - the InputStream to read the data from
Throws:
CertificateException - if an exception occurs while decoding

X509CertPath

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 - 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
Method Detail

getEncoded

public byte[] getEncoded()
                  throws CertificateEncodingException
Returns the encoded form of this certification path, using the default encoding.

Specified by:
getEncoded in class CertPath
Returns:
the encoded bytes
Throws:
CertificateEncodingException - if an encoding error occurs

getEncoded

public byte[] getEncoded(String encoding)
                  throws CertificateEncodingException
Returns the encoded form of this certification path, using the specified encoding.

Specified by:
getEncoded in class CertPath
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

getEncodingsStatic

public static Iterator 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)

getEncodings

public Iterator 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.

Specified by:
getEncodings in class CertPath
Returns:
an Iterator over the names of the supported encodings (as Strings)

getCertificates

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

Specified by:
getCertificates in class CertPath
Returns:
an immutable List of X509Certificates (may be empty, but not null)