JavaScript Editor Javascript validator     Web page editor 

Introduction and Overview

Introduction and Overview -- introduces the Crypt_GPG package


Crypt_GPG is a PHP package to interact with the GNU Privacy Guard (GPG). GPG is a free and open-source implementation of the OpenPGP protocol, providing key managment, data encryption and data signing. Crypt_GPG provides an object-oriented API for performing OpenPGP commands using GPG.

GPG is distributed as an executable program with a command line argument syntax for performing commands. Crypt_GPG uses PHP's program execution functions to run GPG as a subprocess thus performing the desired command. Crypt_GPG automatically handles process control, stream handling and error checking of the GPG 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.

Note: Though GPG can support symmetric-key cryptography, this package is intended only to facilitate public-key cryptography.


The basic internal overview of a GPG command executed in Crypt_GPG is as follows:

  1. build the required command line,

  2. open the GPG subprocess with the command line,

  3. stream data to and from the GPG subprocess on various IPC pipes until the command is finished,

  4. close the GPG subprocess and,

  5. check for errors.

Crypt_GPG handles all these details internally so GPG can be used with minimal effort from the developer.

JavaScript Editor Javascript validator     Web page editor