public class X509CertificateFactory extends CertificateFactory
CertificateFactory
to add support for CertPath
generating
methods. Only used with JDK versions >= 1.4.
By default the IAIK
provider uses
a JDK 1.1.x compliant CertificateFactory
.
However, if a JDK version >= 1.4 is used, the IAIK provider automatically switches
to this CertificateFactory implementation to support the CertPath
generating methods as introduced by JDK1.4 (since they maybe required by some
JREs for jar file verification).
This class extends the default IAIK CertificateFactory about methods to maybe used
for generating a CertPath from a List of certificates or from its encoded representation.
Currently the following encoding formats are supported:
"PkiPath"
(default): DER encoded X.509 PkiPath
DER
: DER encoded certificate chain
PEM
: PEM encoded certificate chain
PKCS7
: PKCS#7 format (degenerate SignedData)
NETSCAPE
: Netscape CertList
default
("PkiPath) encoding format maybe used, or an encoding format may be explictly
specified, e.g.:
CertificateFactory certFactory = CertificateFactory.getInstance("X.509", "IAIK"); // the stream from which to read the certificates in, e.g., PKCS#7 format InputStream in = ...; // create CertPath CertPath certPath = certFactory.generateCertPath(in, X509CertPath.PKCS7); ...
CertificateFactory
,
X509CertPath
,
X509Certificate
Constructor and Description |
---|
X509CertificateFactory() |
Modifier and Type | Method and Description |
---|---|
java.security.cert.CertPath |
engineGenerateCertPath(java.io.InputStream inStream)
Generates a
CertPath object from the certificates
parsed from the given input stream. |
java.security.cert.CertPath |
engineGenerateCertPath(java.io.InputStream inStream,
java.lang.String encoding)
Generates a
CertPath object from the certificates
parsed from the given input stream, encoded in the given format. |
java.security.cert.CertPath |
engineGenerateCertPath(java.util.List certificates)
Generates a
CertPath from the certificates contained
in the given list. |
java.util.Iterator |
engineGetCertPathEncodings()
Returns an iterator of all CertPath encoding formats supported by this
CertificateFactory.
|
engineGenerateCertificate, engineGenerateCertificates, engineGenerateCRL, engineGenerateCRLs
public java.util.Iterator engineGetCertPathEncodings()
Currently the following encoding formats are supported:
engineGetCertPathEncodings
in class java.security.cert.CertificateFactorySpi
public java.security.cert.CertPath engineGenerateCertPath(java.util.List certificates) throws java.security.cert.CertificateException
CertPath
from the certificates contained
in the given list.
engineGenerateCertPath
in class java.security.cert.CertificateFactorySpi
certificates
- the certificate list from which to create the cert pathCertPath
for the given certificate listjava.security.cert.CertificateException
- if an exception occurs while creating the cert pathpublic java.security.cert.CertPath engineGenerateCertPath(java.io.InputStream inStream) throws java.security.cert.CertificateException
CertPath
object from the certificates
parsed from the given input stream. The input stream has to
supply the certificates in the default encoding format
(@link CertPath#DEFAULT_ENCODING_FORMAT "PkiPath"} used
by this CertificateFactory/CertPath implementation:
PkiPath ::= SEQUENCE OF CertificateThe certificates in a PKI path are ordered in a way that the certificate at index i has issued the certificate at index i+1. This means that the certificate that has been issued by the trust anchor is located at index 0 and the target cert is located at index (n-1). (The trust anchor itself shall not be included in the path).
engineGenerateCertPath
in class java.security.cert.CertificateFactorySpi
inStream
- the input stream from which to read the pki pathCertPath
for the certificates parsed from the pki pathjava.security.cert.CertificateException
- if an error occurs while parsing the certificates
from the pki pathpublic java.security.cert.CertPath engineGenerateCertPath(java.io.InputStream inStream, java.lang.String encoding) throws java.security.cert.CertificateException
CertPath
object from the certificates
parsed from the given input stream, encoded in the given format.
engineGenerateCertPath
in class java.security.cert.CertificateFactorySpi
inStream
- the input stream from which to path the certificatesencoding
- the encoding format that has been used for encoding the certificatesCertPath
for the certificates parsed from the streamjava.security.cert.CertificateException
- if an error occurs while parsing the certificates
or the given encoding format is not supported