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

Class: Crypt_GPG_Engine

Source Location: /Crypt_GPG-1.0.0/GPG/Engine.php

Class Overview


Native PHP Crypt_GPG I/O engine


Author(s):

Copyright:

  • 2005-2008 silverorange

Methods


Inherited Variables

Inherited Methods


Class Details

[line 78]
Native PHP Crypt_GPG I/O engine

This class is used internally by Crypt_GPG and does not need be used directly. See the Crypt_GPG class for end-user API.

This engine uses PHP's native process control functions to directly control the GPG process. The GPG executable is required to be on the system.

All data is passed to the GPG subprocess using file descriptors. This is the most secure method of passing data to the GPG subprocess.



[ Top ]


Method Detail

addErrorHandler   [line 431]

void addErrorHandler( callback $callback, [ $args = array()])

Adds an error handler method

The method is run every time a new error line is received from the GPG subprocess. The handler method must accept the error line to be handled as its first parameter.

  • Access: public

Parameters:

callback   $callback     the callback method to use.
array   $args     optional. Additional arguments to pass as parameters to the callback method.

[ Top ]

addStatusHandler   [line 455]

void addStatusHandler( callback $callback, [ $args = array()])

Adds a status handler method

The method is run every time a new status line is received from the GPG subprocess. The handler method must accept the status line to be handled as its first parameter.

  • Access: public

Parameters:

callback   $callback     the callback method to use.
array   $args     optional. Additional arguments to pass as parameters to the callback method.

[ Top ]

__construct (Constructor)   [line 345]

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

Creates a new GPG engine

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 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.
  • 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 useful to diagnose errors when using Crypt_GPG.

  • Throws: PEAR_Exception if the provided binary is invalid, or if no binary is provided and no suitable binary could be found.
  • 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.
  • Access: public

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 ]

__destruct (Destructor)   [line 410]

void __destruct( )

Closes open GPG subprocesses when this object is destroyed

Subprocesses should never be left open by this class unless there is an unknown error and unexpected script termination occurs.

  • Access: public

[ Top ]

getErrorCode   [line 559]

integer getErrorCode( )

Gets the error code of the last executed operation

This value is only meaningful after Crypt_GPG_Engine::run() has been executed.

  • Return: the error code of the last executed operation.
  • Access: public

[ Top ]

reset   [line 494]

void reset( )

Resets the GPG engine, preparing it for a new operation

[ Top ]

run   [line 535]

void run( )

Runs the current GPG operation

This creates and manages the GPG subprocess.

The operation must be set with Crypt_GPG_Engine::setOperation() before this method is called.


[ Top ]

sendCommand   [line 476]

void sendCommand( string $command)

Sends a command to the GPG subprocess over the command file-descriptor pipe
  • Access: public

Parameters:

string   $command     the command to send.

[ Top ]

setInput   [line 577]

void setInput( string|resource &$input)

Sets the input source for the current GPG operation
  • Access: public

Parameters:

string|resource   &$input     either a reference to the string containing the input data or an open stream resource containing the input data.

[ Top ]

setMessage   [line 597]

void setMessage( string|resource &$message)

Sets the message source for the current GPG operation

Detached signature data should be specified here.

  • Access: public

Parameters:

string|resource   &$message     either a reference to the string containing the message data or an open stream resource containing the message data.

[ Top ]

setOperation   [line 639]

void setOperation( string $operation, [ $arguments = array()])

Sets the operation to perform

Parameters:

string   $operation     the operation to perform. This should be one of GPG's operations. For example, --encrypt, --decrypt, --sign, etc.
array   $arguments     optional. Additional arguments for the GPG subprocess. See the GPG manual for specific values.

[ Top ]

setOutput   [line 615]

void setOutput( string|resource &$output)

Sets the output destination for the current GPG operation
  • Access: public

Parameters:

string|resource   &$output     either a reference to the string in which to store GPG output or an open stream resource to which the output data should be written.

[ Top ]


Documentation generated on Thu, 22 Jan 2009 21:30:09 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.