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();
-
PKCS12()
- Default constructor.
-
PKCS12(ASN1Object)
- Creates a PKCS#12 object from a ASN1Object.
-
PKCS12(String)
- Create a PKCS#12 object from a file.
-
decode()
-
-
decrypt(String)
- Uses the provided password to decrypt the exported PKCS#12 object.
-
getCertificateList()
- Returns the certificate list from this PKCS#12 object.
-
getPrivateKey()
- Returns the private key from this PKCS#12 object.
-
toASN1Object()
- Returns this PKCS#12 object as ASN1Object.
-
toString()
- Returns a string that represents the contents of the extensions.
PKCS12
public PKCS12()
- Default constructor. Creates an empty object.
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
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
decode
protected void decode() throws PKCSException
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
getPrivateKey
public RSAPrivateKey getPrivateKey()
- Returns the private key from this PKCS#12 object.
- Returns:
- the private key
getCertificateList
public X509Certificate[] getCertificateList()
- Returns the certificate list from this PKCS#12 object.
- Returns:
- the certificate list
toASN1Object
public ASN1Object toASN1Object()
- Returns this PKCS#12 object as ASN1Object.
- Returns:
- this PKCS#12 object as ASN1Object
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