gpgme: encrypt/decrypt help

Michael Nguyen michaeln at twentyten.org
Fri Aug 12 07:43:14 CEST 2005


So, I've been going through the samples, and I'm still sort of unclear about
how to get the right public key read in so I can do an encryption.  I'm
looking at the following function:

gpgme_error_t gpgme_op_encrypt (gpgme_ctx_t ctx, gpgme_key_t recp[],
gpgme_encrypt_flags_t flags, gpgme_data_t plain, gpgme_data_t cipher)

The question is, how do I build these recipients?  I have a bunch of public
keys in a MySQL database keyed by email address.  I want to populate recp[]
with these public keys and encrypt, but I'm not sure how to go about doing
that.

Could someone give me a quick tutorial on how to get this going?  You know,
something like:

 - Take your text keys from MySQL and read it into a char string
 - Run gpgme_blah_blah with blah and blah to turn the public keys into the
recp array
 - Pass that value to gpgme_op_encrypt and away you go

Thanks for your patience guys.  I'll keep going over the samples...


Michael




More information about the Gnupg-users mailing list