All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.pkcs.PKCS7

java.lang.Object
   |
   +----iaik.pkcs.PKCS7

public class PKCS7
extends Object
This class implements applications of the PKCS#7 standard. At this time just PKCS#7 objects which contain only a chain of certificates as used by Netscape Navigator and Microsoft Internet Explorer are implemented. Files of this type use the extension: .p7c

Usage:

X509Certificate[] certs = ...; PKCS7 pkcs7 = new PKCS7(); pkcs7.createCertificateList(certs); pkcs7.setFormat(ASN1.DER); pkcs7.saveToFile(pkcs7File); or: PKCS7 pkcs7 = new PKCS7("certs.p7c"); X509Certificate[] certs = pkcs7.getCertificateList();


Constructor Index

 o PKCS7()
Default constructor.
 o PKCS7(byte[])
Create a PKCS#7 object from a byte array.
 o PKCS7(String)
Create a PKCS#7 object from a file.

Method Index

 o createCertificateList(X509Certificate[])
Creates a PKCS#7 object which contains only a chain of certificates as used by Netscape Navigator and Microsoft Internet Explorer.
 o getCertificateList()
Returns the certificates included in the PKCS#7 object.
 o saveToFile(String)
Saves this PKCS#7 object into a file.
 o setFormat(int)
Sets the desired format for returned data.
 o toByteArray()
Returns the PKCS#7 object as a byte array.
 o toString()
Returns a string that represents the contents of this PKCS#7 ContentInfo.
 o toString(boolean)
Returns a string that represents the contents of this PKCS#7 ContentInfo.

Constructors

 o PKCS7
 public PKCS7()
Default constructor. Creates an empty object.

 o PKCS7
 public PKCS7(String fileName) throws IOException, PKCSException
Create a PKCS#7 object from a file. The encoding format can be PEM or DER.

Parameters:
fileName - the name of the file containing the object
Throws: IOException
if the object could not be read
Throws: PKCSException
if the object could not be created
 o PKCS7
 public PKCS7(byte array[]) throws PKCSException
Create a PKCS#7 object from a byte array. The encoding format can be PEM or DER.

Parameters:
array - the array containing the object
Throws: PKCSException
if the object could not be created

Methods

 o getCertificateList
 public X509Certificate[] getCertificateList()
Returns the certificates included in the PKCS#7 object.

Returns:
the certificates included in the PKCS#7 object
 o createCertificateList
 public void createCertificateList(X509Certificate certificateList[]) throws PKCSException
Creates a PKCS#7 object which contains only a chain of certificates as used by Netscape Navigator and Microsoft Internet Explorer. Files of this type use the extension: .p7c

Parameters:
certificateList - the chain of certificates as array
Throws: PKCSException
if the PKCS#7 object could not be created
 o saveToFile
 public void saveToFile(String fileName) throws IOException
Saves this PKCS#7 object into a file.

Parameters:
fileName - the name of the file
Throws: IOException
if an error occurs during saving the file
 o toByteArray
 public byte[] toByteArray()
Returns the PKCS#7 object as a byte array. The encoding format (PEM or DER) can be set using setFormat(int).

Returns:
the PKCS#7 object as a byte array.
 o setFormat
 public void setFormat(int format)
Sets the desired format for returned data.

Parameters:
format - ASN1.PEM or ASN1.DER
 o toString
 public String toString()
Returns a string that represents the contents of this PKCS#7 ContentInfo.

Returns:
the string representation
Overrides:
toString in class Object
 o toString
 public String toString(boolean detailed)
Returns a string that represents the contents of this PKCS#7 ContentInfo.

Parameters:
detailed - - whether or not to give detailed information
Returns:
the string representation

All Packages  Class Hierarchy  This Package  Previous  Next  Index