aspose file tools*
The moose likes Security and the fly likes Bouncy Castle API: invalid header encountered - using GnuPG v1.4.9 (MingW32) key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "Bouncy Castle API: invalid header encountered - using GnuPG v1.4.9 (MingW32) key " Watch "Bouncy Castle API: invalid header encountered - using GnuPG v1.4.9 (MingW32) key " New topic
Author

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

Rakesh Megharaj
Greenhorn

Joined: Dec 13, 2012
Posts: 12
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
Bartender

Joined: Jan 17, 2008
Posts: 2435
    
  28

"Bouncy developer", please check your private messages for an important administrative matter
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1084
    
  10

So what code are you using to encrypt? You do mean encrypt and not decrypt don't you?
Rakesh Megharaj
Greenhorn

Joined: Dec 13, 2012
Posts: 12
I've resolved the issue, needed to convert java.IO.InputStream to a BCPGInputStream using PGPUtil.getDecoderStream before creating PGPPublicKeyRingCollection.
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bouncy Castle API: invalid header encountered - using GnuPG v1.4.9 (MingW32) key