running gpg from another program
cblack at mokey.com
Wed Feb 3 15:54:05 CET 1999
Hi, I'm messing around with writing some C code so I can call gpg from
another program (like a frontend).
As for the passphrase, you have an option to specify a file descriptor to
read the passphrase from, but you say to avoid using this option if possible.
So should I do some sort of chat/expect thing where I fork a gpg process,
wait for the passphrase prompt, and then have the user enter the passphrase
in a dialog and pass that to gpg's stdin?
What would be the best way of doing this so I can then dump a text buffer
through gpg's stdin for it to encrypt?
I've already figured out the "--output -" syntax to specify stdout for the
I'm thinking (for encrypt):
exec "gpg --encrypr --armor -r userid --output -"
and clone the stdin/stdout of that process...
then read that proc's stdout until I see "Enter passphrase:" and then
write the passphrase to the gpg proc's stdin, then dump the input text buffer
to gpg's stdin and then read and record the output on gpg's stdout.
Is there a better/easier/more accepted way to do this?
Thanks for any info, and yes, I am looking through the code of some pgp
More information about the Gnupg-devel