com.ibm.crypto.provider
Class X509Factory

java.lang.Object
  extended by java.security.cert.CertificateFactorySpi
      extended by com.ibm.crypto.provider.X509Factory

public class X509Factory
extends CertificateFactorySpi

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

See Also:
CertificateFactorySpi, Certificate, CRL, X509Certificate, X509CRL, X509CertImpl, X509CRLImpl

Field Summary
static String BEGIN_CERT
           
static String END_CERT
           
protected static String pkcs7String
           
protected static String pkipString
           
protected static String x509String
           
 
Constructor Summary
X509Factory()
           
 
Method Summary
 Certificate engineGenerateCertificate(InputStream is)
          Generates an X.509 certificate object and initializes it with the data read from the input stream is.
 Collection engineGenerateCertificates(InputStream is)
          Returns a (possibly empty) collection view of X.509 certificates read from the given input stream is.
 CertPath engineGenerateCertPath(InputStream inStream)
          Generates a CertPath object and initializes it with the data read from the input stream inStream.
 CertPath engineGenerateCertPath(InputStream inStream, String encoding)
          Generates a CertPath object and initializes it with the data read from the input stream inStream.
 CertPath engineGenerateCertPath(List certificates)
          Generates a CertPath object and initializes it with the list of certificates supplied.
 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 engineGenerateCRLs(InputStream is)
          Returns a (possibly empty) collection view of X.509 CRLs read from the given input stream is.
 Iterator engineGetCertPathEncodings()
          Returns the encodings supported by this certification path factory, with the default encoding first.
static com.ibm.security.x509.X509CertImpl intern(X509Certificate c)
          Return an interned X509CertImpl for the given certificate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEGIN_CERT

public static final String BEGIN_CERT
See Also:
Constant Field Values

END_CERT

public static final String END_CERT
See Also:
Constant Field Values

pkcs7String

protected static final String pkcs7String
See Also:
Constant Field Values

pkipString

protected static final String pkipString
See Also:
Constant Field Values

x509String

protected static final String x509String
See Also:
Constant Field Values
Constructor Detail

X509Factory

public X509Factory()
Method Detail

engineGenerateCertificate

public Certificate engineGenerateCertificate(InputStream is)
                                      throws CertificateException
Generates an X.509 certificate object and initializes it with the data read from the input stream is.

Specified by:
engineGenerateCertificate in class CertificateFactorySpi
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.

intern

public static com.ibm.security.x509.X509CertImpl intern(X509Certificate c)
                                                 throws CertificateException
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.

Throws:
CertificateException

engineGenerateCertificates

public Collection engineGenerateCertificates(InputStream is)
                                      throws CertificateException
Returns a (possibly empty) collection view of X.509 certificates read from the given input stream is.

Specified by:
engineGenerateCertificates in class CertificateFactorySpi
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.

engineGenerateCRL

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

Specified by:
engineGenerateCRL in class CertificateFactorySpi
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.

engineGenerateCRLs

public Collection engineGenerateCRLs(InputStream is)
                              throws CRLException
Returns a (possibly empty) collection view of X.509 CRLs read from the given input stream is.

Specified by:
engineGenerateCRLs in class CertificateFactorySpi
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.

engineGenerateCertPath

public CertPath engineGenerateCertPath(InputStream inStream)
                                throws CertificateException
Generates a CertPath object and initializes it with the data read from the input stream inStream. The data is assumed to be in the default encoding.

Overrides:
engineGenerateCertPath in class CertificateFactorySpi
Parameters:
inStream - an input stream with the data
Returns:
a CertPath initialized with the data from the input stream
Throws:
CertificateException - if an exception occurs
CertificateException

engineGenerateCertPath

public CertPath engineGenerateCertPath(InputStream inStream,
                                       String encoding)
                                throws CertificateException
Generates a CertPath object and initializes it with the data read from the input stream inStream. The data is assumed to be in the specified encoding.

Overrides:
engineGenerateCertPath in class CertificateFactorySpi
Parameters:
inStream - an input stream with the data
encoding - the encoding used for the data
Returns:
a CertPath initialized with the data from the input stream
Throws:
CertificateException - if an exception occurs
CertificateException

engineGenerateCertPath

public CertPath engineGenerateCertPath(List certificates)
                                throws CertificateException
Generates a CertPath object and initializes it with the list of certificates supplied. The certificates supplied must be of a type supported by the CertPathFactory.

Overrides:
engineGenerateCertPath in class CertificateFactorySpi
Parameters:
certificates - a List of Certificates
Returns:
a CertPath initialized with the supplied list of certificates
Throws:
CertificateException - if an exception occurs
CertificateException

engineGetCertPathEncodings

public Iterator engineGetCertPathEncodings()
Returns the encodings supported by this certification path factory, with the default encoding first.

Overrides:
engineGetCertPathEncodings in class CertificateFactorySpi
Returns:
an Iterator of the encodings supported