I have developed an application and using the following keys for digital signatures those of which were placed in a file path (Directory) in
testing environment.
1) XXX.p12 file - for Digital signature.
2) XXX.p12 file - for decryption of XML response.
3) XXX.cer file - for encrypting the session keys , input XML etc.
Since the files are on a particular file path location , the code is running fine.So for in the pre-production environment we have procured the CryptoGraphic Token from a CA and imported the XXX.p12 file for testing of the same, i am successfully able to digitally sign the request , However in case of decrypting the session key that is encrypted by the server using "
RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING" i am getting the error as :-
My Testing Method is :-
I have found the issue is that the implementation of SunJCE's Cipher "
RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING" is not compatible with other implementations (
BouncyCastle/IAIK/PKCS11)
When setting AlgorithmParameters (with OAEPParameterSpec) an exception is thrown (javax.crypto.BadPaddingException)
Refer : Problems with Cipher "RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING" Bug Details:
https://bugs.openjdk.java.net/browse/JDK-7038158?page=com.atlassian.jira.plugin.system.issuetabpanels%3aworklog-tabpanel
Is their any way that i can decrypt the data for RSA-OAEP padding.