Class CertificateFactory
java.lang.Object
java.security.cert.CertificateFactorySpi
org.bouncycastle.jcajce.provider.asymmetric.x509.CertificateFactory
public class CertificateFactory extends CertificateFactorySpi
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.
-
Constructor Summary
Constructors Constructor Description CertificateFactory() -
Method Summary
Modifier and Type Method Description protected CRLcreateCRL(CertificateList c)CertificateengineGenerateCertificate(InputStream in)Generates a certificate object and initializes it with the data read from the input stream inStream.CollectionengineGenerateCertificates(InputStream inStream)Returns a (possibly empty) collection view of the certificates read from the given input stream inStream.CertPathengineGenerateCertPath(InputStream inStream)Generates aCertPathfrom the providedInputStream.CertPathengineGenerateCertPath(InputStream inStream, String encoding)Generates aCertPath(a certificate chain) from the giveninputStream, assuming the givenencodingfromCertificateFactorySpi.engineGetCertPathEncodings().CertPathengineGenerateCertPath(List certificates)Generates aCertPathfrom the provided list of certificates.CRLengineGenerateCRL(InputStream inStream)Generates a certificate revocation list (CRL) object and initializes it with the data read from the input stream inStream.CollectionengineGenerateCRLs(InputStream inStream)Returns a (possibly empty) collection view of the CRLs read from the given input stream inStream.IteratorengineGetCertPathEncodings()Returns anIteratorover the supportedCertPathencodings (as Strings).
-
Constructor Details
-
CertificateFactory
public CertificateFactory()
-
-
Method Details
-
createCRL
- Throws:
CRLException
-
engineGenerateCertificate
Generates a certificate object and initializes it with the data read from the input stream inStream.- Specified by:
engineGenerateCertificatein classCertificateFactorySpi- Parameters:
in- the stream from which the data is read to create the certificate.- Returns:
- an initialized certificate.
- Throws:
CertificateException- if parsing problems are detected.
-
engineGenerateCertificates
Returns a (possibly empty) collection view of the certificates read from the given input stream inStream.- Specified by:
engineGenerateCertificatesin classCertificateFactorySpi- Parameters:
inStream- the stream from where data is read to create the certificates.- Returns:
- a collection of certificates.
- Throws:
CertificateException- if parsing problems are detected.
-
engineGenerateCRL
Generates a certificate revocation list (CRL) object and initializes it with the data read from the input stream inStream.- Specified by:
engineGenerateCRLin classCertificateFactorySpi- Parameters:
inStream- the stream from where data is read to create the CRL.- Returns:
- an CRL instance.
- Throws:
CRLException- if parsing problems are detected.
-
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.- Specified by:
engineGenerateCRLsin classCertificateFactorySpi- Parameters:
inStream- the stream from which the data is read to create the CRLs.- Returns:
- a collection of CRLs.
- Throws:
CRLException- if parsing problems are detected.
-
engineGetCertPathEncodings
Description copied from class:CertificateFactorySpiReturns anIteratorover the supportedCertPathencodings (as Strings). The first element is the default encoding.- Overrides:
engineGetCertPathEncodingsin classCertificateFactorySpi- Returns:
- an iterator over supported
CertPathencodings (as Strings).
-
engineGenerateCertPath
Description copied from class:CertificateFactorySpiGenerates aCertPathfrom the providedInputStream. The default encoding scheme is applied.- Overrides:
engineGenerateCertPathin classCertificateFactorySpi- Parameters:
inStream- an input stream with encoded data.- Returns:
- a
CertPathinitialized from the provided data. - Throws:
CertificateException- if parsing problems are detected.
-
engineGenerateCertPath
public CertPath engineGenerateCertPath(InputStream inStream, String encoding) throws CertificateExceptionDescription copied from class:CertificateFactorySpiGenerates aCertPath(a certificate chain) from the giveninputStream, assuming the givenencodingfromCertificateFactorySpi.engineGetCertPathEncodings().- Overrides:
engineGenerateCertPathin classCertificateFactorySpi- Throws:
CertificateException- if parsing problems are detected.
-
engineGenerateCertPath
Description copied from class:CertificateFactorySpiGenerates aCertPathfrom the provided list of certificates. The encoding is the default encoding.- Overrides:
engineGenerateCertPathin classCertificateFactorySpi- Parameters:
certificates- the list containing certificates in a format supported by theCertificateFactory.- Returns:
- a
CertPathinitialized from the provided data. - Throws:
CertificateException- if parsing problems are detected.
-