PGPPublicKeyRing from PGPSecretKeyRing

Paul Schaub <[email protected]>
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.