Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Error while using PGP Encryption on windows  RSS feed

 
kiran krishna
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following is the script of code and I am using GPG encryption on windows.

PGPEncryptedDataGenerator encryptGenerator = new PGPEncryptedDataGenerator(PGPEncryptedDataGenerator.CAST5, new SecureRandom(), "BC");
encryptGenerator.addMethod(recipientPublicKey);
outputStream = encryptGenerator.open(outputStream, compressedBytes.length);



I am getting the following error at the last line

org.bouncycastle.openpgp.PGPException: exception encrypting session key
at org.bouncycastle.openpgp.PGPEncryptedDataGenerator.open(PGPEncryptedDataGenerator.java:344)
at com.effigent.projectadjuncts.BCPGPCrypto.encryptedBytes(BCPGPCrypto.java:441)
at com.effigent.projectadjuncts.BCPGPCrypto.encryptedBytes(BCPGPCrypto.java:848)
at Application.<init>(Application.java:59)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:306)
at java.lang.Class.newInstance(Class.java:259)
at com.webobjects.appserver.WOApplication.main(WOApplication.java:296)
at Application.main(Application.java:20)

If some one has any solution please provide

Thanks in Advance
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!