View Single Post
  #17 (permalink)  
Old 07-09-2009, 04:37 PM
pramod_pitta pramod_pitta is offline
Member
 
Join Date: Jul 2009
Posts: 8
Rep Power: 0
pramod_pitta is on a distinguished road
Default
Hi,

I have an issue while decrypting the file in RAD. While running the code (mentioned above) from command prompt it works fine with out any issue. If I run the same code in RAD it gives an exception as below.

read bytes: 31331
byte array31331
decrypt(): data length=31331
publicKeyEncryptedData id=2165468330250183716
my-alg:ElGamal
private keyorg.bouncycastle.openpgp.PGPPrivateKey@5e645e64
org.bouncycastle.openpgp.PGPException: error setting asymmetric cipher
java.security.InvalidKeyException: Illegal key size or default parameters
at javax.crypto.Cipher.a(Unknown Source)
at javax.crypto.Cipher.init(Unknown Source)
at javax.crypto.Cipher.init(Unknown Source)
at org.bouncycastle.openpgp.PGPPublicKeyEncryptedData .fetchSymmetricKeyData(Unknown Source)
at org.bouncycastle.openpgp.PGPPublicKeyEncryptedData .getDataStream(Unknown Source)
at org.bouncycastle.openpgp.PGPPublicKeyEncryptedData .getDataStream(Unknown Source)
at com.fourcs.clm.iwarranty.wc.utilities.Test._decryp t(Test.java:93)
at com.fourcs.clm.iwarranty.wc.utilities.Test.decrypt (Test.java:55)
at com.fourcs.clm.iwarranty.wc.utilities.Test.main(Te st.java:150)
Exception in thread "main" java.lang.NullPointerException
at com.fourcs.clm.iwarranty.wc.utilities.Test.main(Te st.java:153)

By doing some R&D I think the bouncy castle api looks for urestricted cipher jars (US_export_policy & local_policy jars)from //jre/lib/security. But my application classpath will point to our own classpath dir, where all the jars are dumped into it. I copied the (US_export_policy & local_policy jars) into our classpath directory but, still I am facing the same issue.

How can I resolve my problem ? Please help me on this ASAP.

Thanks & Regards,
Pramod
Reply With Quote