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();
-
PKCS7()
- Default constructor.
-
PKCS7(byte[])
- Create a PKCS#7 object from a byte array.
-
PKCS7(String)
- Create a PKCS#7 object from a file.
-
createCertificateList(X509Certificate[])
- Creates a PKCS#7 object which contains only a chain of certificates as used by Netscape
Navigator and Microsoft Internet Explorer.
-
getCertificateList()
- Returns the certificates included in the PKCS#7 object.
-
saveToFile(String)
- Saves this PKCS#7 object into a file.
-
setFormat(int)
- Sets the desired format for returned data.
-
toByteArray()
- Returns the PKCS#7 object as a byte array.
-
toString()
- Returns a string that represents the contents of this
PKCS#7 ContentInfo.
-
toString(boolean)
- Returns a string that represents the contents of this
PKCS#7 ContentInfo.
PKCS7
public PKCS7()
- Default constructor. Creates an empty object.
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
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
getCertificateList
public X509Certificate[] getCertificateList()
- Returns the certificates included in the PKCS#7 object.
- Returns:
- the certificates included in the PKCS#7 object
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
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
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.
setFormat
public void setFormat(int format)
- Sets the desired format for returned data.
- Parameters:
- format - ASN1.PEM or ASN1.DER
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
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