PHP Class Horde_Crypt_Pgp_Backend_Binary, horde

NOTE: This class is NOT intended to be accessed outside of this package. There is NO guarantees that the API of this class will not change across versions.
Author: Michael Slusarz ([email protected])
Inheritance: extends Horde_Crypt_Pgp_Backend
ファイルを表示 Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_gnupg array GnuPG program location/common options.
$_privateKeyring string Filename of the temporary private keyring.
$_publicKeyring string Filename of the temporary public keyring.
$_tempdir string The temporary directory to use.

Public Methods

Method Description
__construct ( string $gnupg, string $temp = null ) Constructor.
_callGpg ( array $options, string $mode, array $input = [], boolean $output = false, boolean $stderr = false, boolean $parseable = false, boolean $verbose = false ) : stdClass Function that handles interfacing with the GnuPG binary.
decryptMessage ( $text, $params )
decryptSignature ( $text, $params )
encryptMessage ( $text, $params )
encryptSignature ( $text, $params )
generateKey ( $opts )
getFingerprintsFromKey ( $pgpdata )
getPublicKeyFromPrivateKey ( $data )
getSignersKeyID ( $text )
isEncryptedSymmetrically ( $text )
packetInfo ( $pgpdata )
packetInfoMultiple ( $pgpdata )

Protected Methods

Method Description
_checkSignatureResult ( string $result, string $message = null ) : object Checks signature result from the GnuPG binary.
_createKeyring ( string $type = 'public' ) : string Creates a temporary gpg keyring.
_createTempFile ( string $descrip = 'horde-crypt', boolean $delete = true ) : string Create a temporary file that will be deleted at the end of this process.
_ensureResult ( object $result ) Checks whether there was some valid output.
_putInKeyring ( mixed $keys = [], string $type = 'public' ) : string Adds PGP keys to the keyring.

Method Details

__construct() public method

Constructor.
public __construct ( string $gnupg, string $temp = null )
$gnupg string The path to the GnuPG binary.
$temp string Location of temporary directory.

_callGpg() public method

Function that handles interfacing with the GnuPG binary.
public _callGpg ( array $options, string $mode, array $input = [], boolean $output = false, boolean $stderr = false, boolean $parseable = false, boolean $verbose = false ) : stdClass
$options array Options and commands to pass to GnuPG.
$mode string 'r' to read from stdout, 'w' to write to stdin.
$input array Input to write to stdin.
$output boolean Collect and store output in object returned?
$stderr boolean Collect and store stderr in object returned?
$parseable boolean Is parseable output required? The gpg binary would be executed with C locale then.
$verbose boolean Run GnuPG with verbose flag?
return stdClass Class with members output, stderr, and stdout.

_checkSignatureResult() protected method

Checks signature result from the GnuPG binary.
protected _checkSignatureResult ( string $result, string $message = null ) : object
$result string The signature result.
$message string The decrypted message data.
return object See decryptSignature().

_createKeyring() protected method

Creates a temporary gpg keyring.
protected _createKeyring ( string $type = 'public' ) : string
$type string The type of key to analyze. 'public' or 'private'.
return string Command line keystring option to use with gpg program.

_createTempFile() protected method

Create a temporary file that will be deleted at the end of this process.
protected _createTempFile ( string $descrip = 'horde-crypt', boolean $delete = true ) : string
$descrip string Description string to use in filename.
$delete boolean Delete the file automatically?
return string Filename of a temporary file.

_ensureResult() protected method

Checks whether there was some valid output.
protected _ensureResult ( object $result )
$result object A result from _callGpg().

_putInKeyring() protected method

Adds PGP keys to the keyring.
protected _putInKeyring ( mixed $keys = [], string $type = 'public' ) : string
$keys mixed A single key or an array of key(s) to add to the keyring.
$type string The type of key(s) to add. 'public' or 'private'.
return string Command line keystring option to use with gpg program.

decryptMessage() public method

public decryptMessage ( $text, $params )

decryptSignature() public method

public decryptSignature ( $text, $params )

encryptMessage() public method

public encryptMessage ( $text, $params )

encryptSignature() public method

public encryptSignature ( $text, $params )

generateKey() public method

public generateKey ( $opts )

getFingerprintsFromKey() public method

public getFingerprintsFromKey ( $pgpdata )

getPublicKeyFromPrivateKey() public method

public getPublicKeyFromPrivateKey ( $data )

getSignersKeyID() public method

public getSignersKeyID ( $text )

isEncryptedSymmetrically() public method

public isEncryptedSymmetrically ( $text )

packetInfo() public method

public packetInfo ( $pgpdata )

packetInfoMultiple() public method

public packetInfoMultiple ( $pgpdata )

Property Details

$_gnupg protected_oe property

GnuPG program location/common options.
protected array $_gnupg
return array

$_privateKeyring protected_oe property

Filename of the temporary private keyring.
protected string $_privateKeyring
return string

$_publicKeyring protected_oe property

Filename of the temporary public keyring.
protected string $_publicKeyring
return string

$_tempdir protected_oe property

The temporary directory to use.
protected string $_tempdir
return string