gpgme: encrypt/decrypt

Michael Nguyen michaeln at twentyten.org
Sun Aug 14 01:53:05 CEST 2005


I'd normally post this to gnupg-users, but they don't seem to be much help
right now...

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 in advance.


Michael





More information about the Gnupg-devel mailing list