gpgme: encrypt/decrypt

Michael Nguyen michaeln at
Tue Aug 16 20:22:19 CEST 2005

From: "Werner Koch" <wk at>

> On Sat, 13 Aug 2005 16:53:05 -0700, Michael Nguyen said:
> >  - Take your text keys from MySQL and read it into a char string
> 1. import the keys into gpg's keyring; use gpgme_op_import.
> 2. Do nothing
> 3. Use the fingerprint or the user ID or the keyID of the key and put
>    it into the recipients array.

Hi Werner...

I guess this is more of a program design question.  Should I be able to do
what I want to do here?  I'm creating a Postfix content filter for the
company that automatically does GPG encryption/decryption on incoming and
outgoing corporate mail.  What I wanted to do is have the user's private and
public key stored as a TEXT type in MySQL.  I've been told that I would
likely need to store the keyring file as a binary BLOB instead, write it to
a temp file, do my work with it, and then remove the temp file.

Is this correct?  The overall idea of the program is this:

 - Email gets delivered to SMTP server
 - Content filter knows who's sending the email and who the recipients are
 - Filter uses this user information to encrypt the message
 - Filter returns the email to SMTP

I do something similar for incoming delivery (except that it's even easier
because I don't have to search for recipients).  If I can just take that PGP
key and slap it into gpgme_op_import then that'd be even better, but from
what I've heard, I can't do that.


More information about the Gnupg-devel mailing list