Welling & Thomson's book, PHP and MySQL Web Development, 1st or 2d ed, has a chapter with code for encrypting GPG and sending it by email. (You don't need to do the email part.)
In 1st ed. it's chapter 15, the private_mail.php and send_private_mail scripts.
I got it to work in windows 98, under Apache 1.3.27-win32 and php 4.3.0.
They use the system() command:
system ($command, $result);
But for windows you need double backslashes in the paths in $command and $command needs to be on one line, e.g.:
$command = "C:\windows\gpg -a --output $outfile --recipient yourUserId@whatever.com --encrypt $infile";
system ($command, $result);
Also, for the last $fp in their listing, you need to do:
fclose ($fp);
after its last use.
To tell the system where to find the keyring use:
putenv (""GNUPGHOME=C:/gnupg/");
Now, can anyone help me write a script for decrypting a GPG message?
The problem is dealing with the passphrase. None of the references that I've found worked, e.g., using proc_open() with pipes. Some comments in the documentation hint that it can be done but give no details.