Top Description Fields Constructors Methods
org.bouncycastle.jcajce.provider

pack-priv Class CertificateFactory

extends CertificateFactorySpi
Class Inheritance
Imports
java.io.BufferedInputStream, .ByteArrayInputStream, .IOException, .InputStream, java.security.cert.CRL, .CRLException, .CertPath, .CertificateException, .CertificateFactorySpi, .CertificateParsingException, .X509Certificate, java.util.ArrayList, .Collection, .Enumeration, .Iterator, .List, org.bouncycastle.asn1.ASN1Encodable, .ASN1EncodableVector, .ASN1InputStream, .ASN1ObjectIdentifier, .ASN1Sequence, .ASN1SequenceParser, .ASN1Set, .ASN1SetParser, .ASN1StreamParser, .ASN1TaggedObject, .BERTaggedObjectParser, .DERSequence, .DERSet, org.bouncycastle.asn1.cms.SignedDataParser, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, .SignedData, org.bouncycastle.asn1.x509.Certificate, .CertificateList, org.bouncycastle.util.io.Streams

class for dealing with X509 certificates.

At the moment this will deal with "-----BEGIN CERTIFICATE-----" to "-----END CERTIFICATE-----" base 64 encoded certs, as well as the BER binaries of certificates and some classes of PKCS#7 objects.

Field Summary

Modifier and TypeField and Description
private ASN1StreamParser
private InputStream
private InputStream
private final BouncyCastleFipsProvider
private static final PEMUtil
private static final PEMUtil
private ASN1Set
private int
private ASN1Set
private int
private SignedDataParser

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected CRL
public Certificate
engineGenerateCertificate(InputStream
an input stream with the certificate data.
in
)

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCertificate.

Generates a certificate object and initializes it with the data read from the input stream inStream.
public Collection<E>
engineGenerateCertificates(InputStream
the input stream with the certificates.
inStream
)

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCertificates.

Returns a (possibly empty) collection view of the certificates read from the given input stream inStream.
public CertPath
engineGenerateCertPath(InputStream
an InputStream containing the data
inStream
)

Overrides java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

Generates a CertPath object and initializes it with the data read from the InputStream inStream.
public CertPath
engineGenerateCertPath(InputStream
an InputStream containing the data
inStream
,
String
the encoding used for the data
encoding
)

Overrides java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

Generates a CertPath object and initializes it with the data read from the InputStream inStream.
public CertPath
engineGenerateCertPath(List<E>
a List of Certificates
certificates
)

Overrides java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

Generates a CertPath object and initializes it with a List of Certificates.
public CRL
engineGenerateCRL(InputStream
an input stream with the CRL data.
inStream
)

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCRL.

Generates a certificate revocation list (CRL) object and initializes it with the data read from the input stream inStream.
public Collection<E>
engineGenerateCRLs(InputStream
the input stream with the CRLs.
inStream
)

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCRLs.

Returns a (possibly empty) collection view of the CRLs read from the given input stream inStream.
public Iterator<E>
engineGetCertPathEncodings()

Overrides java.security.cert.CertificateFactorySpi.engineGetCertPathEncodings.

Returns an iteration of the CertPath encodings supported by this certificate factory, with the default encoding first.
private Certificate
private CRL
private ASN1Set
private Certificate
private CRL
readCrl(InputStream inStream)

private Certificate
private CRL
private Certificate
private CRL

Field Detail

currentAsn1Parserback to summary
private ASN1StreamParser currentAsn1Parser
currentCrlStreamback to summary
private InputStream currentCrlStream
currentStreamback to summary
private InputStream currentStream
fipsProviderback to summary
private final BouncyCastleFipsProvider fipsProvider
PEM_CERT_PARSERback to summary
private static final PEMUtil PEM_CERT_PARSER
PEM_CRL_PARSERback to summary
private static final PEMUtil PEM_CRL_PARSER
sCrlDataback to summary
private ASN1Set sCrlData
sCrlDataObjectCountback to summary
private int sCrlDataObjectCount
sDataback to summary
private ASN1Set sData
sDataObjectCountback to summary
private int sDataObjectCount
signedDataParserback to summary
private SignedDataParser signedDataParser

Constructor Detail

CertificateFactoryback to summary
pack-priv CertificateFactory(BouncyCastleFipsProvider fipsProvider)

Method Detail

createCRLback to summary
protected CRL createCRL(CertificateList c) throws CRLException
engineGenerateCertificateback to summary
public Certificate engineGenerateCertificate(InputStream in) throws CertificateException

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCertificate.

Generates a certificate object and initializes it with the data read from the input stream inStream.

Parameters
in:InputStream

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertificate.

an input stream with the certificate data.

Returns:Certificate

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertificate.

a certificate object initialized with the data from the input stream.

Exceptions
CertificateException:

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertificate.

on parsing errors.

engineGenerateCertificatesback to summary
public Collection<E> engineGenerateCertificates(InputStream inStream) throws CertificateException

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCertificates.

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

Parameters
inStream:InputStream

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertificates.

the input stream with the certificates.

Returns:Collection<E>

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertificates.

a (possibly empty) collection view of java.security.cert.Certificate objects initialized with the data from the input stream.

Exceptions
CertificateException:

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertificates.

on parsing errors.

engineGenerateCertPathback to summary
public CertPath engineGenerateCertPath(InputStream inStream) throws CertificateException

Overrides java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

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.

This method was added to version 1.4 of the Java 2 Platform Standard Edition. In order to maintain backwards compatibility with existing service providers, this method cannot be abstract and by default throws an UnsupportedOperationException.

Parameters
inStream:InputStream

an InputStream containing the data

Returns:CertPath

a CertPath initialized with the data from the InputStream

Exceptions
CertificateException:
if an exception occurs while decoding
engineGenerateCertPathback to summary
public CertPath engineGenerateCertPath(InputStream inStream, String encoding) throws CertificateException

Overrides java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

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.

This method was added to version 1.4 of the Java 2 Platform Standard Edition. In order to maintain backwards compatibility with existing service providers, this method cannot be abstract and by default throws an UnsupportedOperationException.

Parameters
inStream:InputStream

an InputStream containing the data

encoding:String

the encoding used for the data

Returns:CertPath

a CertPath initialized with the data from the InputStream

Exceptions
CertificateException:
if an exception occurs while decoding or the encoding requested is not supported
engineGenerateCertPathback to summary
public CertPath engineGenerateCertPath(List<E> certificates) throws CertificateException

Overrides java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCertPath.

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.

This method was added to version 1.4 of the Java 2 Platform Standard Edition. In order to maintain backwards compatibility with existing service providers, this method cannot be abstract and by default throws an UnsupportedOperationException.

Parameters
certificates:List<E>

a List of Certificates

Returns:CertPath

a CertPath initialized with the supplied list of certificates

Exceptions
CertificateException:
if an exception occurs
engineGenerateCRLback to summary
public CRL engineGenerateCRL(InputStream inStream) throws CRLException

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCRL.

Generates a certificate revocation list (CRL) object and initializes it with the data read from the input stream inStream.

Parameters
inStream:InputStream

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCRL.

an input stream with the CRL data.

Returns:CRL

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCRL.

a CRL object initialized with the data from the input stream.

Exceptions
CRLException:

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCRL.

on parsing errors.

engineGenerateCRLsback to summary
public Collection<E> engineGenerateCRLs(InputStream inStream) throws CRLException

Implements abstract java.security.cert.CertificateFactorySpi.engineGenerateCRLs.

Returns a (possibly empty) collection view of the CRLs read from the given input stream inStream. The inStream may contain a sequence of DER-encoded CRLs, or a PKCS#7 CRL set. This is a PKCS#7 SignedData object, with the only signficant field being crls. In particular the signature and the contents are ignored.

Parameters
inStream:InputStream

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCRLs.

the input stream with the CRLs.

Returns:Collection<E>

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCRLs.

a (possibly empty) collection view of java.security.cert.CRL objects initialized with the data from the input stream.

Exceptions
CRLException:

Doc from java.security.cert.CertificateFactorySpi.engineGenerateCRLs.

on parsing errors.

engineGetCertPathEncodingsback to summary
public Iterator<E> engineGetCertPathEncodings()

Overrides java.security.cert.CertificateFactorySpi.engineGetCertPathEncodings.

Doc from java.security.cert.CertificateFactorySpi.engineGetCertPathEncodings.

Returns an iteration of the CertPath encodings supported by this certificate factory, with the default encoding first. See the CertPath Encodings section in the Java Security Standard Algorithm Names Specification for information about standard encoding names.

Attempts to modify the returned Iterator via its remove method result in an UnsupportedOperationException.

This method was added to version 1.4 of the Java 2 Platform Standard Edition. In order to maintain backwards compatibility with existing service providers, this method cannot be abstract and by default throws an UnsupportedOperationException.

Returns:Iterator<E>

an Iterator over the names of the supported CertPath encodings (as Strings)

getCertificateback to summary
private Certificate getCertificate() throws CertificateParsingException, IOException
getCRLback to summary
private CRL getCRL() throws CRLException, IOException
pruneSetback to summary
private ASN1Set pruneSet(ASN1SetParser setParser)
readCertificateback to summary
private Certificate readCertificate(InputStream in) throws CertificateException
readCrlback to summary
private CRL readCrl(InputStream inStream) throws CRLException
readDERCertificateback to summary
private Certificate readDERCertificate() throws IOException, CertificateParsingException
readDERCRLback to summary
private CRL readDERCRL(ASN1InputStream aIn) throws IOException, CRLException
readPEMCertificateback to summary
private Certificate readPEMCertificate(InputStream in) throws IOException, CertificateParsingException
readPEMCRLback to summary
private CRL readPEMCRL(InputStream in) throws IOException, CRLException