Crypt_GPG
[ class tree: Crypt_GPG ] [ index: Crypt_GPG ] [ all elements ]

Class: Crypt_GPGAbstract

Source Location: /Crypt_GPG-1.4.0b4/Crypt/GPGAbstract.php

Class Overview


Base class for implementing a user of Crypt_GPG_Engine


Author(s):

Copyright:

  • 2005-2013 silverorange

Variables

Methods


Child classes:

Crypt_GPG
A class to use GPG from PHP
Crypt_GPG_KeyGenerator
GnuPG key generator

Inherited Variables

Inherited Methods


Class Details

[line 86]
Base class for implementing a user of Crypt_GPG_Engine


[ Top ]


Class Variables

$engine =  null

[line 185]

Engine used to control the GPG subprocess

Type:   Crypt_GPG_Engine


[ Top ]



Method Detail

__construct (Constructor)   [line 276]

Crypt_GPGAbstract __construct( [ $options = array()])

Creates a new GPG object

Available options are:

  • string homedir - the directory where the GPG keyring files are stored. If not specified, Crypt_GPG uses the default of ~/.gnupg.
  • string publicKeyring - the file path of the public keyring. Use this if the public keyring is not in the homedir, or if the keyring is in a directory not writable by the process invoking GPG (like Apache). Then you can specify the path to the keyring with this option (/foo/bar/pubring.gpg), and specify a writable directory (like /tmp) using the homedir option.
  • string privateKeyring - the file path of the private keyring. Use this if the private keyring is not in the homedir, or if the keyring is in a directory not writable by the process invoking GPG (like Apache). Then you can specify the path to the keyring with this option (/foo/bar/secring.gpg), and specify a writable directory (like /tmp) using the homedir option.
  • string trustDb - the file path of the web-of-trust database. Use this if the trust database is not in the homedir, or if the database is in a directory not writable by the process invoking GPG (like Apache). Then you can specify the path to the trust database with this option (/foo/bar/trustdb.gpg), and specify a writable directory (like /tmp) using the homedir option.
  • string binary - the location of the GPG binary. If not specified, the driver attempts to auto-detect the GPG binary location using a list of known default locations for the current operating system. The option gpgBinary is a deprecated alias for this option.
  • string agent - the location of the GnuPG agent binary. The gpg-agent is only used for GnuPG 2.x. If not specified, the engine attempts to auto-detect the gpg-agent binary location using a list of know default locations for the current operating system.
  • boolean debug - whether or not to use debug mode. When debug mode is on, all communication to and from the GPG subprocess is logged. This can be

  • Throws: Crypt_GPG_FileException if the homedir does not exist and cannot be created. This can happen if homedir is not specified, Crypt_GPG is run as the web user, and the web user has no home directory. This exception is also thrown if any of the options publicKeyring, privateKeyring or trustDb options are specified but the files do not exist or are are not readable. This can happen if the user running the Crypt_GPG process (for example, the Apache user) does not have permission to read the files.
  • Throws: PEAR_Exception if the provided binary is invalid, or if no binary is provided and no suitable binary could be found.
  • Throws: PEAR_Exception if the provided agent is invalid, or if no agent is provided and no suitable gpg-agent cound be found.
  • Access: public

Overridden in child classes as:

Crypt_GPG_KeyGenerator::__construct()
Creates a new GnuPG key generator

Parameters:

array   $options     optional. An array of options used to create the GPG object. All options are optional and are represented as key-value pairs.

[ Top ]

setEngine   [line 294]

Crypt_GPGAbstract setEngine( Crypt_GPG_Engine $engine)

Sets the I/O engine to use for GnuPG operations

Normally this method does not need to be used. It provides a means for dependency injection.

  • Return: the current object, for fluent interface.
  • Access: public

Parameters:

Crypt_GPG_Engine   $engine     the engine to use.

[ Top ]

_getKeys   [line 326]

array _getKeys( [string $keyId = ''])

Gets the available keys in the keyring

Calls GPG with the --list-keys command and grabs keys. See the first section of doc/DETAILS in the GPG package for a detailed description of how the GPG command output is parsed.

  • Return: an array of Crypt_GPG_Key objects. If no keys match the specified $keyId an empty array is returned.
  • See: Crypt_GPG_Key
  • Throws: Crypt_GPG_Exception if an unknown or unexpected error occurs. Use the debug option and file a bug report if these exceptions occur.
  • Access: protected

Parameters:

string   $keyId     optional. Only keys with that match the specified pattern are returned. The pattern may be part of a user id, a key id or a key fingerprint. If not specified, all keys are returned.

[ Top ]


Documentation generated on Wed, 13 Mar 2013 18:30:09 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.