• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Bouncy developer", please check your private messages for an important administrative matter
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
This is my favorite show. And this is my favorite tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic