I just created a PKCS12-File using the program demo.pkcs.pkcs12.PKCS12Create.
Now I want to read the Certificate in this file using the following lines of code:
public static X509Certificate readCertificate (String Filename)
//read the certificate
PKCS12 PKCS12_OBJECT = new PKCS12(new FileInputStream(Filename));
// Decrypt the PKCS12-Object using the password "test"
// Get the CertificateBags
CertificateBag Cert_Bag = PKCS12_OBJECT.getCertificateBags();
// Return the certificate
When I start this method with the generated file as parameter it throws the Exception "iaik.pkcs.PKCSException: Unable to decrypt PrivateKey!" in the decrypt-line.
Does anyone have any idea what the reason maybe? I'm a total newbie to java/security/iaik... so any help would be nice.
Thanks in advance.