ice.cert
Class X509CertificateFactory

java.lang.Object
  extended byice.cert.X509CertificateFactory

public class X509CertificateFactory
extends Object

This class defines the functionality of a certificate factory, which is used to generate certificate objects from their encodings.

This implementation is compliant to the specifications given in jdk1.2's java.security.cert.X509Certificate. However few differences can be noticed:

Since:
ICEsecure 1.1
Author:
Jerome Bugnet
See Also:
X509Certificate

Constructor Summary
X509CertificateFactory()
           
 
Method Summary
 X509Certificate generateCertificate(InputStream inStream)
          Generates a certificate object and initializes it with the data read from the input stream inStream.
 X509Certificate[] generateCertificates(InputStream inStream)
          Returns a (possibly empty) collection view of the certificates read from the given input stream inStream.
 Provider getProvider()
          Returns the provider of this certificate factory.
 String getType()
          Returns the name of the certificate type associated with this certificate factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X509CertificateFactory

public X509CertificateFactory()
Method Detail

generateCertificate

public X509Certificate generateCertificate(InputStream inStream)
                                    throws CertificateException
Generates a certificate object and initializes it with the data read from the input stream inStream.

The given input stream inStream must contain a single X509 certificate. The certificate provided in inStream must be DER-encoded and may be supplied in binary or printable (Base64) encoding.

Note that this method will consume the entire input stream.

Parameters:
inStream - an input stream with the certificate data.
Returns:
a certificate object initialized with the data from the input stream.
Throws:
CertificateException - on parsing errors.

generateCertificates

public X509Certificate[] generateCertificates(InputStream inStream)
                                       throws CertificateException
Returns a (possibly empty) collection view of the certificates read from the given input stream inStream.

The given input stream inStream must contain a sequence of DER-encoded certificates in the formats described for generateCertificate and may be supplied in binary or printable (Base64) encoding.
In addition, inStream may contain a PKCS#7 certificate chain or a Netscape certificate chain. These formats allow multiple certificates to be downloaded at once.
If no certificates are present, an empty collection is returned.
In the case of base64 encoding, the whole chain must be encoded in one base64 sequence. If the stream contains several base64 encoded objects (i.e. several "-----BEGIN XXX----- ... -----END XXX-----") only the first one is read.

See netscape site for a description of the netscape certificate chain format, and RSA Security site for the PKCS#7 format.

Note that this method will consume the entire input stream.

Parameters:
inStream - the input stream with the certificates.
Returns:
a (possibly empty) collection view of java.security.cert.Certificate objects initialized with the data from the input stream.
Throws:
CertificateException - on parsing errors.

getProvider

public Provider getProvider()
Returns the provider of this certificate factory.

Returns:
the provider of this certificate factory.

getType

public String getType()
Returns the name of the certificate type associated with this certificate factory.

Returns:
"X.509" for this implementation.