Crypt_GPG is a PHP package to interact with the GNU Privacy Guard (GnuPG). GnuPG is a free and open-source implementation of the OpenPGP protocol, providing key management, data encryption and data signing. Crypt_GPG provides an object-oriented API for performing OpenPGP actions using GnuPG.
GnuPG is distributed as an executable program with a command-line argument syntax for performing actions. Crypt_GPG uses PHP's program execution functions to run GnuPG as a subprocess, performing the desired action. Crypt_GPG automatically handles process control, stream handling and error checking of the GnuPG subprocess. Crypt_GPG uses PHP streams internally for most actions, allowing (among other things) any streamable resource to be used with the Crypt_GPG file commands.
Though GnuPG can support symmetric-key cryptography, this package is intended only to facilitate public-key cryptography.
The basic internal overview of a GnuPG command executed in Crypt_GPG is as follows:
build the required command line,
open the GnuPG subprocess with the command line,
stream data to and from the GnuPG subprocess on various IPC pipes until the command is finished,
close the GnuPG subprocess and,
check for errors.
Crypt_GPG handles all these details internally so GnuPG can be used with minimal effort from the developer.