How to get signature list from PGPPublicKey using Bouncy Castle library?
I have a PGPPublicKey object. I want to get a list of all signatures (with user id, email id, trust level for each singature) associated with it using the Bouncy Castle API. I tried but couldn't figure it out. If anyone has a link to an example or what method can be used to get it, please let me know.
source to share
I've never used these classes, but I thought it might be helpful to post some resources.
It looks like the OpenPGP Bouncy Castle releases include a few examples .
I recommend using these examples to solve your problem. In particular, it looks like you will need to use the classes PGPSignatureList
and PGPSignature
that are used in the examples. However, I don't see emailId
in any of the classes.
- SignedFileProcessor.java : A simple utility class that signs and verifies files.
- DetachedSignatureProcessor.java : A simple utility class that creates separate signatures for files and validates them.
Additionally, http://www.bouncycastle.org/documentation.html suggests the following.
Finally, there are also code examples from Getting Started Cryptography with Java that demonstrate both the use of JCE / JCA and some of the Bouncy Castle APIs such as certificate generation, CMS and S / MIME. Note: The book was written to cover J2SE 5.0, while many of the examples will work with earlier JDKs, some will not compile unless you are using J2SE 5.0 or later.
source to share