Re: PGPPublicKeyRing from PGPSecretKeyRing
Paul Schaub <[email protected]>
| Newsgroups | gmane.comp.encryption.bouncy-castle.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi! Thanks for the hint! Unfortunately the PGPKeyRingGenerator does not what I need, as I already have an existing PGPSecretKeyRing and don't want to generate a fresh one. However, the class pointed me to the List-Constructor of PGPPublicKeyRing, which unfortunately is package-private in BC 1.59. I assume, that this constructor will be come public in the next release, as it already is public in the master branch. I ended up accessing that constructor using reflections for now, which does the job for me :) Thank you for your input :) PS: Do you have any hint about when the next BC version will be released? :) Am 11.06.2018 um 03:13 schrieb David Hook: > There's code for this in PGPKeyRingGenerator - actually you might find > it does the job. I'd be interested to know if it doesn't. > > Regards, > > David > > On 10/06/18 20:29, Paul Schaub wrote: >> Hi! >> >> I'm currently working with BouncyCastle on an OpenPGP Java project. For >> that reason I have to create OpenPGP key pairs for the user. >> >> I created a builder that returns a PGPSecretKeyRing as result of the >> build() method. Now for convenience I would like to be able to easily >> retrieve the PGPPublicKeyRing from the secret key ring. >> >> For now the only way to accomplish that that I came across is, to >> serialize the PGPSecretKeyRing to a byte array and deserialize it into a >> PGPPublicKeyRing. Same procedure applies if I want to convert a key ring >> into a key ring collection. However, this appears a little inefficient >> to me. >> >> Is there a better way to do this? >> >> Greetings >> Paul >> >> >> >> >