public class

X509Factory

extends CertificateFactorySpi
java.lang.Object
   ↳ java.security.cert.CertificateFactorySpi
     ↳ sun.security.provider.X509Factory

Class Overview

This class defines a certificate factory for X.509 v3 certificates & certification paths, and X.509 v2 certificate revocation lists (CRLs).

Summary

Constants
String BEGIN_CERT
String END_CERT
Public Constructors
X509Factory()
Public Methods
CRL engineGenerateCRL(InputStream is)
Generates an X.509 certificate revocation list (CRL) object and initializes it with the data read from the given input stream is.
Collection<? extends CRL> engineGenerateCRLs(InputStream is)
Returns a (possibly empty) collection view of X.509 CRLs read from the given input stream is.
CertPath engineGenerateCertPath(InputStream inStream, String encoding)
Generates a CertPath object and initializes it with the data read from the InputStream inStream.
CertPath engineGenerateCertPath(List<? extends Certificate> certificates)
Generates a CertPath object and initializes it with a List of Certificates.
CertPath engineGenerateCertPath(InputStream inStream)
Generates a CertPath object and initializes it with the data read from the InputStream inStream.
Certificate engineGenerateCertificate(InputStream is)
Generates an X.509 certificate object and initializes it with the data read from the input stream is.
Collection<? extends Certificate> engineGenerateCertificates(InputStream is)
Returns a (possibly empty) collection view of X.509 certificates read from the given input stream is.
Iterator<String> engineGetCertPathEncodings()
Returns an iteration of the CertPath encodings supported by this certificate factory, with the default encoding first.
synchronized static X509CertImpl intern(X509Certificate c)
Return an interned X509CertImpl for the given certificate.
synchronized static X509CRLImpl intern(X509CRL c)
Return an interned X509CRLImpl for the given certificate.
[Expand]
Inherited Methods
From class java.security.cert.CertificateFactorySpi
From class java.lang.Object

Constants

public static final String BEGIN_CERT

Constant Value: "-----BEGIN CERTIFICATE-----"

public static final String END_CERT

Constant Value: "-----END CERTIFICATE-----"

Public Constructors

public X509Factory ()

Public Methods

public CRL engineGenerateCRL (InputStream is)

Generates an X.509 certificate revocation list (CRL) object and initializes it with the data read from the given input stream is.

Parameters
is an input stream with the CRL data.
Returns
  • an X.509 CRL object initialized with the data from the input stream.
Throws
CRLException on parsing errors.

public Collection<? extends CRL> engineGenerateCRLs (InputStream is)

Returns a (possibly empty) collection view of X.509 CRLs read from the given input stream is.

Parameters
is the input stream with the CRLs.
Returns
  • a (possibly empty) collection view of X.509 CRL objects initialized with the data from the input stream.
Throws
CRLException on parsing errors.

public CertPath engineGenerateCertPath (InputStream inStream, String encoding)

Generates a CertPath object and initializes it with the data read from the InputStream inStream. The data is assumed to be in the specified encoding.

Parameters
inStream an InputStream containing the data
encoding the encoding used for the data
Returns
  • a CertPath initialized with the data from the InputStream
Throws
CertificateException if an exception occurs while decoding or the encoding requested is not supported

public CertPath engineGenerateCertPath (List<? extends Certificate> certificates)

Generates a CertPath object and initializes it with a List of Certificates.

The certificates supplied must be of a type supported by the CertificateFactory. They will be copied out of the supplied List object.

Parameters
certificates a List of Certificates
Returns
  • a CertPath initialized with the supplied list of certificates
Throws
CertificateException if an exception occurs

public CertPath engineGenerateCertPath (InputStream inStream)

Generates a CertPath object and initializes it with the data read from the InputStream inStream. The data is assumed to be in the default encoding.

Parameters
inStream an InputStream containing the data
Returns
  • a CertPath initialized with the data from the InputStream
Throws
CertificateException if an exception occurs while decoding

public Certificate engineGenerateCertificate (InputStream is)

Generates an X.509 certificate object and initializes it with the data read from the input stream is.

Parameters
is an input stream with the certificate data.
Returns
  • an X.509 certificate object initialized with the data from the input stream.
Throws
CertificateException on parsing errors.

public Collection<? extends Certificate> engineGenerateCertificates (InputStream is)

Returns a (possibly empty) collection view of X.509 certificates read from the given input stream is.

Parameters
is the input stream with the certificates.
Returns
  • a (possibly empty) collection view of X.509 certificate objects initialized with the data from the input stream.
Throws
CertificateException on parsing errors.

public Iterator<String> engineGetCertPathEncodings ()

Returns an iteration of the CertPath encodings supported by this certificate factory, 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 CertPath encodings (as Strings)

public static synchronized X509CertImpl intern (X509Certificate c)

Return an interned X509CertImpl for the given certificate. If the given X509Certificate or X509CertImpl is already present in the cert cache, the cached object is returned. Otherwise, if it is a X509Certificate, it is first converted to a X509CertImpl. Then the X509CertImpl is added to the cache and returned. Note that all certificates created via generateCertificate(InputStream) are already interned and this method does not need to be called. It is useful for certificates that cannot be created via generateCertificate() and for converting other X509Certificate implementations to an X509CertImpl.

public static synchronized X509CRLImpl intern (X509CRL c)

Return an interned X509CRLImpl for the given certificate. For more information, see intern(X509Certificate).

Throws
CRLException