Skip to content

Most visited

Recently visited

navigation
Added in API level 1

CertificateFactory

public class CertificateFactory
extends Object

java.lang.Object
   ↳ java.security.cert.CertificateFactory


This class implements the functionality of a certificate factory algorithm, relying on parsing a stream of bytes.

It defines methods for parsing certificate chains (certificate paths) and Certificate Revocation Lists (CRLs).

Summary

Protected constructors

CertificateFactory(CertificateFactorySpi certFacSpi, Provider provider, String type)

Creates a new CertificateFactory instance.

Public methods

final CRL generateCRL(InputStream inStream)

Generates and initializes a Certificate Revocation List (CRL) from the provided input stream.

final Collection<? extends CRL> generateCRLs(InputStream inStream)

Generates and initializes a collection of Certificate Revocation List (CRL) from the provided input stream.

final CertPath generateCertPath(InputStream inputStream, String encoding)

Generates a CertPath (a certificate chain) from the given inputStream, assuming the given encoding from getCertPathEncodings().

final CertPath generateCertPath(InputStream inStream)

Generates a CertPath (a certificate chain) from the provided InputStream.

final CertPath generateCertPath(List<? extends Certificate> certificates)

Generates a CertPath from the provided list of certificates.

final Certificate generateCertificate(InputStream inStream)

Generates and initializes a Certificate from the provided input stream.

final Collection<? extends Certificate> generateCertificates(InputStream inStream)

Generates and initializes a collection of (unrelated) certificates from the provided input stream.

final Iterator<String> getCertPathEncodings()

Returns an Iterator over the supported CertPath encodings (as Strings).

final static CertificateFactory getInstance(String type, String provider)

Creates a new CertificateFactory instance from the specified provider that provides the requested certificate type.

final static CertificateFactory getInstance(String type, Provider provider)

Creates a new CertificateFactory instance from the specified provider that provides the requested certificate type.

final static CertificateFactory getInstance(String type)

Creates a new CertificateFactory instance that provides the requested certificate type.

final Provider getProvider()

Returns the Provider of the certificate factory represented by the certificate.

final String getType()

Returns the Certificate type.

Inherited methods

From class java.lang.Object

Protected constructors

CertificateFactory

Added in API level 1
CertificateFactory (CertificateFactorySpi certFacSpi, 
                Provider provider, 
                String type)

Creates a new CertificateFactory instance.

Parameters
certFacSpi CertificateFactorySpi: the implementation delegate.
provider Provider: the associated provider.
type String: the certificate type.

Public methods

generateCRL

Added in API level 1
CRL generateCRL (InputStream inStream)

Generates and initializes a Certificate Revocation List (CRL) from the provided input stream.

Parameters
inStream InputStream: the stream from where data is read to create the CRL.
Returns
CRL an initialized CRL.
Throws
CRLException if parsing problems are detected.

generateCRLs

Added in API level 1
Collection<? extends CRL> generateCRLs (InputStream inStream)

Generates and initializes a collection of Certificate Revocation List (CRL) from the provided input stream.

Parameters
inStream InputStream: the stream from which the data is read to create the CRLs.
Returns
Collection<? extends CRL> an initialized collection of CRLs.
Throws
CRLException if parsing problems are detected.

generateCertPath

Added in API level 1
CertPath generateCertPath (InputStream inputStream, 
                String encoding)

Generates a CertPath (a certificate chain) from the given inputStream, assuming the given encoding from getCertPathEncodings().

Parameters
inputStream InputStream
encoding String
Returns
CertPath
Throws
CertificateException if parsing problems are detected.
UnsupportedOperationException if the provider does not implement this method.

generateCertPath

Added in API level 1
CertPath generateCertPath (InputStream inStream)

Generates a CertPath (a certificate chain) from the provided InputStream. The default encoding scheme is applied.

Parameters
inStream InputStream: InputStream with encoded data.
Returns
CertPath a CertPath initialized from the provided data.
Throws
CertificateException if parsing problems are detected.

generateCertPath

Added in API level 1
CertPath generateCertPath (List<? extends Certificate> certificates)

Generates a CertPath from the provided list of certificates. The encoding is the default encoding.

Parameters
certificates List: the list containing certificates in a format supported by the CertificateFactory.
Returns
CertPath a CertPath initialized from the provided data.
Throws
CertificateException if parsing problems are detected.
UnsupportedOperationException if the provider does not implement this method.

generateCertificate

Added in API level 1
Certificate generateCertificate (InputStream inStream)

Generates and initializes a Certificate from the provided input stream.

Parameters
inStream InputStream: the stream from where data is read to create the Certificate.
Returns
Certificate an initialized Certificate.
Throws
CertificateException if parsing problems are detected.

generateCertificates

Added in API level 1
Collection<? extends Certificate> generateCertificates (InputStream inStream)

Generates and initializes a collection of (unrelated) certificates from the provided input stream.

Parameters
inStream InputStream: the stream from which the data is read to create the collection.
Returns
Collection<? extends Certificate> an initialized collection of certificates.
Throws
CertificateException if parsing problems are detected.

getCertPathEncodings

Added in API level 1
Iterator<String> getCertPathEncodings ()

Returns an Iterator over the supported CertPath encodings (as Strings). The first element is the default encoding scheme to apply.

Returns
Iterator<String> an iterator over supported CertPath encodings (as Strings).

getInstance

Added in API level 1
CertificateFactory getInstance (String type, 
                String provider)

Creates a new CertificateFactory instance from the specified provider that provides the requested certificate type.

Parameters
type String: the certificate type.
provider String: the name of the provider providing certificates of the specified type.
Returns
CertificateFactory the new CertificateFactory instance.
Throws
CertificateException if the specified certificate type is not available by the specified provider.
NoSuchProviderException if no provider with the specified name can be found.
IllegalArgumentException if provider == null || provider.isEmpty()
NullPointerException it type is null.

getInstance

Added in API level 1
CertificateFactory getInstance (String type, 
                Provider provider)

Creates a new CertificateFactory instance from the specified provider that provides the requested certificate type. The provider supplied does not have to be registered.

Parameters
type String: the certificate type.
provider Provider: the name of the provider providing certificates of the specified type.
Returns
CertificateFactory the new CertificateFactory instance.
Throws
CertificateException if the specified certificate type is not available at the specified provider.
IllegalArgumentException if the specified provider is null.
NullPointerException if type == null
IllegalArgumentException if provider == null

getInstance

Added in API level 1
CertificateFactory getInstance (String type)

Creates a new CertificateFactory instance that provides the requested certificate type.

Parameters
type String: the certificate type.
Returns
CertificateFactory the new CertificateFactory instance.
Throws
CertificateException if the specified certificate type is not available at any installed provider.
NullPointerException if type == null

getProvider

Added in API level 1
Provider getProvider ()

Returns the Provider of the certificate factory represented by the certificate.

Returns
Provider the provider of this certificate factory.

getType

Added in API level 1
String getType ()

Returns the Certificate type.

Returns
String type of certificate being used.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.