All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class iaik.pkcs.PKCS12

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

public class PKCS12
extends Object
This class is an early test implementation of PKCS#12. At this time just Microsoft Internet Exoplorer exported certificates which contain a certificate chain and the private key can be parsed.

Usage:

PKCS12 pkcs12 = new PKCS12("file.export"); System.out.println(pkcs12); pkcs12.decrypt("password"); // the password used when exporting System.out.println(pkcs12); RSAPrivateKey pk = pkcs12.getPrivateKey(); X509Certificate[] certList = pkcs12.getCertificateList();


Constructor Index

 o PKCS12()
Default constructor.
 o PKCS12(ASN1Object)
Creates a PKCS#12 object from a ASN1Object.
 o PKCS12(String)
Create a PKCS#12 object from a file.

Method Index

 o decode()
 o decrypt(String)
Uses the provided password to decrypt the exported PKCS#12 object.
 o getCertificateList()
Returns the certificate list from this PKCS#12 object.
 o getPrivateKey()
Returns the private key from this PKCS#12 object.
 o toASN1Object()
Returns this PKCS#12 object as ASN1Object.
 o toString()
Returns a string that represents the contents of the extensions.

Constructors

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

 o PKCS12
 public PKCS12(String fileName) throws IOException, PKCSException
Create a PKCS#12 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 PKCS12
 public PKCS12(ASN1Object obj) throws PKCSException
Creates a PKCS#12 object from a ASN1Object.

Parameters:
obj - the PKCS#12 object as a ASN1Object
Throws: PKCSException
if the ASN1Object could not be parsed

Methods

 o decode
 protected void decode() throws PKCSException
 o decrypt
 public void decrypt(String password) throws PKCSException
Uses the provided password to decrypt the exported PKCS#12 object.

Parameters:
password - the password to decrypt the PKCS#12 object
Throws: PKCSException
if the PKCS#12 object could not be decrypted
 o getPrivateKey
 public RSAPrivateKey getPrivateKey()
Returns the private key from this PKCS#12 object.

Returns:
the private key
 o getCertificateList
 public X509Certificate[] getCertificateList()
Returns the certificate list from this PKCS#12 object.

Returns:
the certificate list
 o toASN1Object
 public ASN1Object toASN1Object()
Returns this PKCS#12 object as ASN1Object.

Returns:
this PKCS#12 object as ASN1Object
 o toString
 public String toString()
Returns a string that represents the contents of the extensions.

Returns:
the string representation
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index