Problems obtaining public and private keys for specific users.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problems obtaining public and private keys for specific users.

David Tooke
I am writing, what should be, a pretty simple application.

I need encrypt a file for a particular user and then decrypt
their response using our private key and pass phrase.

I can perform the encrypt and decrypt fine if I hard code the keys.
But I am having a hard job in retrieving the appropriate keys
from a the key ring files based off of a user id.

If I look at the keyring file in PGP, I'll see a key with an
user name or email address attached to it and I want to be able
to put that name in and get a key out.

I noticed there was a getKeyRings(String s) method on the
PGPPublicKeyRingCollection which I assume I can use somehow, but
I have put in all sorts of userids and email addresses and I
never get anything out other than an iterator with no items.

I haven't been able to find any examples of this, the examples
seem to pick any key to encrypt rather than a *specific* key.
So using the examples against a keyring containing just my key
and the customers, the test file just got encrypted using my key
not the customers...so I could decrypt but they couldn't.

Thanks for any help that you can provide.

David Tooke
[hidden email]