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

Class: Crypt_GPG_Engine

Source Location: /Crypt_GPG-0.7.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 75]
Native PHP Crypt_GPG I/O engine

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 412]

void addErrorHandler( callback $callback, [array $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 436]

void addStatusHandler( callback $callback, [array $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 329]

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

Creates a new GPG engine

Available options:

    1. string  homedir
    - the directory where the GPG keyring files are stored. If not specified, Crypt_GPG uses the default of
    1. ~/.gnupg
    .
    1. string  gpgBinary
    - 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.
    1. 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
    1. gpgBinary
    is invalid, or if no
    1. gpgBinary
    is provided and no suitable binary could be found.
  • Throws: Crypt_GPG_FileException if the
    1. homedir
    does not exist and cannot be created. This can happen if
    1. 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 must be optional and are represented as key-value pairs.

[ Top ]

__destruct (Destructor)   [line 391]

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 540]

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 475]

void reset( )

Resets the GPG engine, preparing it for a new operation

[ Top ]

run   [line 516]

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 457]

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 558]

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 576]

void setMessage( string|resource &$message)

Sets the message source for the current GPG operation
  • 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 618]

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

Sets the operation to perform

Parameters:

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

[ Top ]

setOutput   [line 594]

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 Mon, 11 Mar 2019 15:25:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.