|
||||||||||
| 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();
ContentInfoStream,
SignedDataStream,
X509Certificate, Serialized Form| Constructor Summary | |
PKCS7CertList()
Default constructor. |
|
PKCS7CertList(java.io.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. |
java.lang.String |
toString()
Returns a string giving some information about the contents of this PKCS7CertList object. |
void |
writeTo(java.io.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(java.io.InputStream is)
throws java.io.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 read| Method 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 array
public void writeTo(java.io.OutputStream os)
throws java.io.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 written
public 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 arraypublic java.lang.String toString()
PKCS7CertList object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||