• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bouncy Castle API: invalid header encountered - using GnuPG v1.4.9 (MingW32) key

 
Rakesh Megharaj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually the application which was using GNUPG tool, I am replacing it to use Bouncy Castle (with bcprov-jdk15on-147.jar in the lib folder).I tried to encrypt a file in Bouncy castle api using a public key GnuPG (tried using .gpg as well as .asc file). I am using the bouncy-castle API, I am getting the below error mesage, please advise what direction I should take?

The key I have is using GnuPG v1.4.9 (MingW32) key


java.io.IOException: invalid header encountered
at com.imsi.ees.bcapi.bcpg.BCPGInputStream.readPacket(BCPGInputStream.java:145)
at com.imsi.ees.bcapi.openpgp.PGPLiteralData.<init>(PGPLiteralData.java:36)
at com.imsi.ees.bcapi.openpgp.PGPObjectFactory.nextObject(PGPObjectFactory.java:121)
at com.imsi.ees.bcapi.openpgp.PGPPublicKeyRingCollection.<init>(PGPPublicKeyRingCollection.java:57)
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Bouncy developer", please check your private messages for an important administrative matter
 
Richard Tookey
Bartender
Posts: 1166
17
Java Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what code are you using to encrypt? You do mean encrypt and not decrypt don't you?
 
Rakesh Megharaj
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've resolved the issue, needed to convert java.IO.InputStream to a BCPGInputStream using PGPUtil.getDecoderStream before creating PGPPublicKeyRingCollection.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic