|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.pkcs.PKCS7CertList
This class implements an application of the PKCS#7 standard for dealing with certificate chains as used by Netscape Navigator and Microsoft Internet Explorer.
The PKCS#7 SignedData
content type provides a degenerate case
where there are no signers on the content. It is an intended application of
this degenerate case to be used for disseminating certificates and
certificate-revocation lists.
This class provides several constructors and methods for creating a
SignedData
object only containing a list of X509v3
certificates, writing the list to a file (with extension .p7c
),
and reading it back from the file.
Usage:
X509Certificate[] certs = ...; PKCS7CertList pkcs7 = new PKCS7CertList(); pkcs7.setCertificateList(certs); pkcs7.writeTo(new FileOutputStream(pkcs7File));or:
PKCS7CertList pkcs7 = new PKCS7CertList(new FileInputStream("certs.p7c")); X509Certificate[] certs = pkcs7.getCertificateList();
ContentInfo
,
SignedData
,
X509Certificate
, Serialized FormConstructor Summary | |
PKCS7CertList()
Default constructor. |
|
PKCS7CertList(InputStream is)
Creates a PKCS7CertList from an input stream.
|
Method Summary | |
X509Certificate[] |
getCertificateList()
Returns the certificates included in this PKCS7CertList object. |
X509CRL[] |
getCRLList()
Returns the CRLs included in this PKCS7CertList object. |
void |
setCertificateList(X509Certificate[] certificateList)
Set the certificates for this PKCS#7 SignedData object. |
void |
setCRLList(X509CRL[] crlList)
Set the CRLs for this PKCS#7 SignedData object. |
byte[] |
toByteArray()
Returns this PKCS7CertList object as DER encoded byte array.
|
String |
toString()
Returns a string giving some information about the contents of this PKCS7CertList object. |
void |
writeTo(OutputStream os)
Writes the certificate chain to the given output stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public PKCS7CertList()
PKCS7CertList
object.
Use setCertificateList
for supplying a list of X509Certificates, e.g.:
PKCS7CertList pkcs7 = new PKCS7CertList(); pkcs7.setCertificateList(certs);
public PKCS7CertList(InputStream is) throws IOException, PKCSParsingException
PKCS7CertList
from an input stream.
You may use this constructor for "reading in" a certificate list that
has been written to a .p7c file by using the
writeTo
method, e.g.:
PKCS7CertList pkcs7 = new PKCS7CertList(new FileInputStream("certs.p7c")); X509Certificate[] certs = pkcs7.getCertificateList();
is
- the input stream from where the object shall be readIOException
- if the object could not be readPKCSParsingException
- if the object could not be parsedMethod Detail |
public X509Certificate[] getCertificateList()
PKCS7CertList
object, as array of X509Certificatespublic X509CRL[] getCRLList()
PKCS7CertList
object, as array of X509CRLspublic void setCertificateList(X509Certificate[] certificateList)
certificateList
- the chain of certificates as arraypublic void setCRLList(X509CRL[] crlList)
crlList
- the list of certificates as arraypublic void writeTo(OutputStream os) throws IOException
This method can be used to write the certificate list to a .p7c file, e.g.:
X509Certificate[] certs = ...; PKCS7CertList pkcs7 = new PKCS7CertList(); pkcs7.createCertificateList(certs); pkcs7.writeTo(new FileOutputStream("certs.p7c"));
Use the PKCS7CertList(InputStream is)
for "reading back" the certificate chain from the file.
os
- the output stream to which the certificate chain shall
be writtenIOException
- if an error occurs during writing out the filepublic byte[] toByteArray() throws PKCSException
PKCS7CertList
object as DER encoded byte array.
This method DER encodes the ASN.1 representation of this PKCS#7 cert list an writes it to a byte array.
PKCS7CertList
object as DER encoded byte arrayPKCSException
- if an encoding error occurspublic String toString()
PKCS7CertList
object.toString
in class Object
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |