Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.security.cert
Class CertificateFactory  view CertificateFactory download CertificateFactory.java

java.lang.Object
  extended byjava.security.cert.CertificateFactory

public class CertificateFactory
extends java.lang.Object

This class implements the CertificateFactory class interface used to generate certificates, certificate revocation lists (CRLs), and certificate paths objects from their encoded forms.

Since:
JDK 1.2

Field Summary
private  CertificateFactorySpi certFacSpi
           
private static java.lang.String CERTIFICATE_FACTORY
          The service name for certificate factories.
private  java.security.Provider provider
           
private  java.lang.String type
           
 
Constructor Summary
protected CertificateFactory(CertificateFactorySpi certFacSpi, java.security.Provider provider, java.lang.String type)
          Creates an instance of CertificateFactory.
 
Method Summary
 Certificate generateCertificate(java.io.InputStream inStream)
          Generates a Certificate from the encoded data read from an InputStream.
 java.util.Collection generateCertificates(java.io.InputStream inStream)
          Returns a collection of certificates that were read from the input stream.
 CertPath generateCertPath(java.io.InputStream inStream)
          Generate a CertPath and initialize it with data parsed from the input stream.
 CertPath generateCertPath(java.io.InputStream inStream, java.lang.String encoding)
          Generate a CertPath and initialize it with data parsed from the input stream, using the specified encoding.
 CertPath generateCertPath(java.util.List certificates)
          Generate a CertPath and initialize it with the certificates in the java.util.List argument.
 CRL generateCRL(java.io.InputStream inStream)
          Generates a CRL based on the encoded data read from the InputStream.
 java.util.Collection generateCRLs(java.io.InputStream inStream)
          Generates CRLs based on the encoded data read from the InputStream.
 java.util.Iterator getCertPathEncodings()
          Returns an Iterator of CertPath encodings supported by this factory, with the default encoding first.
static CertificateFactory getInstance(java.lang.String type)
          Gets an instance of the CertificateFactory class representing the specified certificate factory.
static CertificateFactory getInstance(java.lang.String type, java.security.Provider provider)
          Get a certificate factory for the given certificate type from the given provider.
static CertificateFactory getInstance(java.lang.String type, java.lang.String provider)
          Gets an instance of the CertificateFactory class representing the specified certificate factory from the specified provider.
 java.security.Provider getProvider()
          Gets the provider of this implementation.
 java.lang.String getType()
          Returns the type of the certificate this factory creates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CERTIFICATE_FACTORY

private static final java.lang.String CERTIFICATE_FACTORY
The service name for certificate factories.

See Also:
Constant Field Values

certFacSpi

private CertificateFactorySpi certFacSpi

provider

private java.security.Provider provider

type

private java.lang.String type
Constructor Detail

CertificateFactory

protected CertificateFactory(CertificateFactorySpi certFacSpi,
                             java.security.Provider provider,
                             java.lang.String type)
Creates an instance of CertificateFactory.

Method Detail

getInstance

public static final CertificateFactory getInstance(java.lang.String type)
                                            throws CertificateException
Gets an instance of the CertificateFactory class representing the specified certificate factory. If the type is not found then, it throws CertificateException.


getInstance

public static final CertificateFactory getInstance(java.lang.String type,
                                                   java.lang.String provider)
                                            throws CertificateException,
                                                   java.security.NoSuchProviderException
Gets an instance of the CertificateFactory class representing the specified certificate factory from the specified provider. If the type is not found then, it throws CertificateException. If the provider is not found, then it throws java.security.NoSuchProviderException.


getInstance

public static final CertificateFactory getInstance(java.lang.String type,
                                                   java.security.Provider provider)
                                            throws CertificateException
Get a certificate factory for the given certificate type from the given provider.


getProvider

public final java.security.Provider getProvider()
Gets the provider of this implementation.


getType

public final java.lang.String getType()
Returns the type of the certificate this factory creates.


generateCertificate

public final Certificate generateCertificate(java.io.InputStream inStream)
                                      throws CertificateException
Generates a Certificate from the encoded data read from an InputStream.

The input stream must contain only one certificate.

If there exists a specialized certificate class for the certificate format handled by the certificate factory then the return Ceritificate should be a typecast of it. Ex: A X.509 CertificateFactory should return X509Certificate.

For X.509 certificates, the certificate in inStream must be DER encoded and supplied in binary or printable (Base64) encoding. If the certificate is in Base64 encoding, it must be bounded by -----BEGINCERTIFICATE-----, and -----END CERTIFICATE-----.


generateCertificates

public final java.util.Collection generateCertificates(java.io.InputStream inStream)
                                                throws CertificateException
Returns a collection of certificates that were read from the input stream. It may be empty, have only one, or have multiple certificates. For a X.509 certificate factory, the stream may contain a single DER encoded certificate or a PKCS#7 certificate chain. This is a PKCS#7 SignedData object with the most significant field being certificates. If no CRLs are present, then an empty collection is returned.


generateCRL

public final CRL generateCRL(java.io.InputStream inStream)
                      throws CRLException
Generates a CRL based on the encoded data read from the InputStream.

The input stream must contain only one CRL.

If there exists a specialized CRL class for the CRL format handled by the certificate factory then the return CRL should be a typecast of it. Ex: A X.509 CertificateFactory should return X509CRL.


generateCRLs

public final java.util.Collection generateCRLs(java.io.InputStream inStream)
                                        throws CRLException

Generates CRLs based on the encoded data read from the InputStream.

For a X.509 certificate factory, the stream may contain a single DER encoded CRL or a PKCS#7 CRL set. This is a PKCS#7 SignedData object with the most significant field being crls. If no CRLs are present, then an empty collection is returned.


generateCertPath

public final CertPath generateCertPath(java.io.InputStream inStream)
                                throws CertificateException
Generate a CertPath and initialize it with data parsed from the input stream. The default encoding of this factory is used.


generateCertPath

public final CertPath generateCertPath(java.io.InputStream inStream,
                                       java.lang.String encoding)
                                throws CertificateException
Generate a CertPath and initialize it with data parsed from the input stream, using the specified encoding.


generateCertPath

public final CertPath generateCertPath(java.util.List certificates)
                                throws CertificateException
Generate a CertPath and initialize it with the certificates in the java.util.List argument.


getCertPathEncodings

public final java.util.Iterator getCertPathEncodings()
Returns an Iterator of CertPath encodings supported by this factory, with the default encoding first. The returned Iterator cannot be modified.