• 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 : Public Key Retrieval based on the finger print provided

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way to retrieve the public key based on the fingerprint from the collection file (i.e. the .gpg file) using the Bouncy Castle Api (bcprov-jdk15on-147.jar). As i want to move my application using GNUPG tool to Bouncy castle, where the collection and the finger print is provided for the encryption of a file.As encryption in the BC can be achieved through public key.It would be of great help if you could provide some example.

Is .gpg in GNUPG equivalent for both .pkr and .skr files?
 
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
Just load the file into a PGPPublicKeyRingCollection and then iterate though each contained keyring until you find the key with the matching fingerprint! One of the BC PGP examples has 90% of the code you require for doing this!

As far as "Is .gpg in GNUPG equivalent for both .pkr and .skr files" is concerned then I'm not sure what you mean by 'equivalent' . As far as I remember the pubring.gpg file has the same format as a '.pkr' file and the secring.gpg file has the same format as a '.skr' file but you can't use the same Java BC code to load both. If you look at the BC examples and Javadoc you will be able to extrapolate from loading the public key file to loading the private key file.

Since this project sounds like it has a large number of PGP key I'm surprise you are not using a database to hold the public keys. I use a MySQL database for public keys with an index on the email address, the fingerprint and the customer name.
 
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
Thanks for the quick reply.
I will try this one.
We are using the Database to store the PGPKeys.
 
reply
    Bookmark Topic Watch Topic
  • New Topic