I obtained iaik_jce.jar file from thirdparty. I am using it to decrypt a pfx file. When i am calling decrypt api then i am getting Unable to decrypt PrivateKey! exception. Below is the piece of code which i use for decryption.
FileInputStream inStream = new FileInputStream(currentCredentialFile.getAbsoluteFile());
pkcs12 = new PKCS12(inStream);
pkcs12.decrypt(currentCredentialPassword.toCharArray());
Below is the exception stack trace
Caused by: iaik.pkcs.PKCSException: Unable to decrypt PrivateKey!
at iaik.pkcs.pkcs12.AuthenticatedSafe.decrypt(Unknown Source)
at iaik.pkcs.pkcs12.PKCS12.decrypt(Unknown Source)
at com.raja.testapp.TestApplicatioin.main(TestApplicatioin.java:32)
Do i need to make any configuration changes for using iaik_jce.jar file for decryption.
I solved the issue myself. I needed to do some initialization which i did not do before.
Adding the above statement did the trick