[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[iaik-jce] Pkcs#12 private key problem

I managed to export a certificate along with it's private key from my IE5 to a *.pfx file. The browser stated that the format was going to be pkcs#12. The private key was password protected.
The code I use is as follows:
public class iaik_test {
 public static void main(String args[]){
   FileInputStream fis = new FileInputStream("c:\\jdk1.2.2\\jre\\lib\\security\\nortel.pfx");
   PKCS12 pck = new PKCS12(fis);
  }catch(Exception e){System.out.println(e.toString());}
The output I get is :
PKCS#12 object:
Version: 3
AuthenticatedSafe: 0
SafeBag: 0
PKCS8ShroudedKeyBag: not decrypted yet!
AuthenticatedSafe: 1
Content encrypted with: PbeWithSHAAnd40BitRC2-CBC
No SafeBags or not decrypted yet.

iaik.pkcs.PKCSException: Unable to decrypt PrivateKey!
I then removed the decrypt(), and proceded to obtain the AuthenticatedSafe[] .
The second element was encrypted, and I tried to execute the AuthenticatedSafe.decrypt(password);
I get the error:
iaik.pkcs.PKCSException: java.security.NoSuchAlgorithmException: AlgorithmParameters not available
Could anyone help me out on how to fix this. All I need is the private key from this file.