gnuPG

Description

Class to interact with the gnuPG.

  • version: $Id: gnuPG_class.inc,v 1.0.8 2005-04-24 17:03:00-05 egarcia Exp $
  • since: Viernes, Enero 30, 2004
  • license: GNU Public License
  • copyright: Copyright (c) 2004-2005, EGM :: Ingenieria sin fronteras
  • author: Enrique Garcia Molina <mailto:egarcia@egm.as>

	
			
Variable Summary
string $error
string $output
Method Summary
void gnuPG ([string $program_path = false], [string $home_directory = false])
mixed Decrypt (string $KeyID, string $Passphrase, string $Text)
mixed DeleteKey (string $KeyID, [string $KeyKind = 'public'])
mixed Encrypt (string $KeyID, string $Passphrase, string $RecipientKeyID, string $Text)
mixed Export ([string $KeyID = false])
mixed GenKey (string $RealName, string $Comment, string $Email, [string $Passphrase = ''], string $ExpireDate, [string $KeyType = 'DSA'], [int $KeyLength = 1024], [string $SubkeyType = 'ELG-E'], [int $SubkeyLength = 1024])
mixed Import (string $KeyBlock)
mixed ListKeys ([string $KeyKind = 'public'])
bool SignKey (string $KeyID, string $Passphrase, string $KeyIDToSign, [int $CheckLevel = 0])
Variables
string $error (line 55)

Error and status messages

string $output (line 61)

Output message

Methods
Constructor gnuPG (line 73)

Create the gnuPG object.

Set the program path for the GNUPG and the home directory of the keyring. If this parameters are not specified, according to the OS the function derive the values.

void gnuPG ([string $program_path = false], [string $home_directory = false])
  • string $program_path: Full program path for the GNUPG
  • string $home_directory: Home directory of the keyring
Decrypt (line 375)

Decrypt the data.

If the decrypted file is signed, the signature is also verified.

  • return: false on error, the clear (decrypted) data on success
mixed Decrypt (string $KeyID, string $Passphrase, string $Text)
  • string $KeyID: the key id to decrypt
  • string $Passphrase: the passphrase to open the key used to decrypt
  • string $Text: data to decrypt
DeleteKey (line 413)

Remove key from the public keyring.

If secret is specified it try to remove the key from from the secret and public keyring. The returned error codes are:

  1. = no such key
  2. = must delete secret key first
  3. = ambiguos specification

  • return: true on success, otherwise false or the delete error code
mixed DeleteKey (string $KeyID, [string $KeyKind = 'public'])
  • string $KeyID: the key id to be removed, if this is the secret key you must specify the fingerprint
  • string $KeyKind: the kind of the keys, can be secret or public
Encrypt (line 350)

Encrypt and sign data.

  • return: false on error, the encrypted data on success
mixed Encrypt (string $KeyID, string $Passphrase, string $RecipientKeyID, string $Text)
  • string $KeyID: the key id used to encrypt
  • string $Passphrase: the passphrase to open the key used to encrypt
  • string $RecipientKeyID: the recipient key id
  • string $Text: data to encrypt
Export (line 219)

Export a key.

Export all keys from all keyrings, or if at least one name is given, those of the given name.

  • return: false on error, the key block with the exported keys
mixed Export ([string $KeyID = false])
  • string $KeyID: The Key ID to export
GenKey (line 291)

Generate a new key pair.

  • return: false on error, the fingerprint of the created key pair in success
mixed GenKey (string $RealName, string $Comment, string $Email, [string $Passphrase = ''], string $ExpireDate, [string $KeyType = 'DSA'], [int $KeyLength = 1024], [string $SubkeyType = 'ELG-E'], [int $SubkeyLength = 1024])
  • string $RealName: The real name of the user or key.
  • string $Comment: Any explanatory commentary.
  • string $Email: The e-mail for the user.
  • string $Passphrase: Passphrase for the secret key, default is not to use any passphrase.
  • string $ExpireDate: Set the expiration date for the key (and the subkey). It may either be entered in ISO date format (2000-08-15) or as number of days, weeks, month or years (<number>[d|w|m|y]). Without a letter days are assumed.
  • string $KeyType: Set the type of the key, the allowed values are DSA and RSA, default is DSA.
  • int $KeyLength: Length of the key in bits, default is 1024.
  • string $SubkeyType: This generates a secondary key, currently only one subkey can be handled ELG-E.
  • int $SubkeyLength: Length of the subkey in bits, default is 1024.
Import (line 245)

Import/merge keys.

This adds the given keys to the keyring. New keys are appended to your keyring and already existing keys are updated. Note that GnuPG does not import keys that are not self-signed.

  • return: false on error, the array with [KeyID, UserID] elements of imported keys on success.
mixed Import (string $KeyBlock)
  • string $KeyBlock: The PGP block with the key(s).
ListKeys (line 160)

Get the keys from the KeyRing.

The returned array get the following elements: [RecordType, CalculatedTrust, KeyLength, Algorithm, KeyID, CreationDate, ExpirationDate, LocalID, Ownertrust, UserID]

  • return: false on error, the array with the keys in the keyring in success
mixed ListKeys ([string $KeyKind = 'public'])
  • string $KeyKind: the kind of the keys, can be secret or public
SignKey (line 456)

Make a signature on key.

If the key is not yet signed by the specified user.

  • return: true on success, otherwise false
bool SignKey (string $KeyID, string $Passphrase, string $KeyIDToSign, [int $CheckLevel = 0])
  • string $KeyID: the key id used to sign
  • string $Passphrase: the passphrase to open the key used to sign
  • string $KeyIDToSign: the key to be signed
  • int $CheckLevel: the check level (0, 1, 2, 3 -casual to extensive-)

Documentation generated on Sun, 24 Apr 2005 20:13:55 -0500 by phpDocumentor 1.2.3