PHP Class Horde_Pgp, horde

Author: Michael Slusarz ([email protected])
Author: Jan Schneider ([email protected])
Exibir arquivo Open project: horde/horde

Protected Properties

Property Type Description
$_backends array List of initialized backends.
$_params array Configuration parameters.

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
decrypt ( mixed $text, mixed $key ) : Horde_Pgp_Element_Message Decrypts text using a PGP private key.
decryptSymmetric ( mixed $text, string $passphrase ) : array Decrypts text using a PGP symmetric passphrase.
encrypt ( string $text, mixed $keys, array $opts = [] ) : Horde_Pgp_Element_Message Encrypts text using PGP public keys.
encryptSymmetric ( string $text, mixed $passphrase, array $opts = [] ) : Horde_Pgp_Element_Message Encrypts text using a PGP symmetric passphrase.
generateKey ( string $name, string $email, array $opts = [] ) : Horde_Pgp_Key_Private Generates a private key.
sign ( string $text, mixed $key, array $opts = [] ) : Horde_Pgp_Element_Message Sign data using a PGP private key.
signCleartext ( string $text, mixed $key, array $opts = [] ) : Horde_Pgp_Element_SignedMessage Sign data using a PGP private key, creating cleartext output.
signDetached ( string $text, mixed $key, array $opts = [] ) : Horde_Pgp_Element_Signature Sign data using a PGP private key, returning a detached signature.
verify ( mixed $text, mixed $key ) : array Verifies text using a PGP public key.
verifyDetached ( mixed $text, mixed $sig, mixed $key ) : { Verifies text using a PGP public key and a detached signature.

Protected Methods

Method Description
_getCipher ( $opts, $default ) TODO
_getCompression ( $opts, $default ) TODO
_getOption ( $opts, $default, $name, $map ) TODO
_getPrivateKey ( $key ) TODO
_initDrivers ( ) Initialize the backend driver list.
_runInBackend ( $cmd, $args, $error ) TODO

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array Configuration parameters: - backends: (array) The explicit list of backend drivers (Horde_Pgp_Backend objects) to use.

_getCipher() protected method

TODO
protected _getCipher ( $opts, $default )

_getCompression() protected method

TODO
protected _getCompression ( $opts, $default )

_getOption() protected method

TODO
protected _getOption ( $opts, $default, $name, $map )

_getPrivateKey() protected method

TODO
protected _getPrivateKey ( $key )

_initDrivers() protected method

Initialize the backend driver list.
protected _initDrivers ( )

_runInBackend() protected method

TODO
protected _runInBackend ( $cmd, $args, $error )

decrypt() public method

Decrypts text using a PGP private key.
public decrypt ( mixed $text, mixed $key ) : Horde_Pgp_Element_Message
$text mixed The text to be decrypted.
$key mixed The private key to use for decryption (must be decrypted).
return Horde_Pgp_Element_Message $msg The decrypted message.

decryptSymmetric() public method

Decrypts text using a PGP symmetric passphrase.
public decryptSymmetric ( mixed $text, string $passphrase ) : array
$text mixed The text to be decrypted.
$passphrase string The symmetric passphrase used to encrypt the data.
return array $data Array of decrypted data. Outer array indicates a message block. Each entry is an array with two array elements: a list of data packets contained in that message block and a list of signature data associated with that block.

encrypt() public method

Encrypts text using PGP public keys.
public encrypt ( string $text, mixed $keys, array $opts = [] ) : Horde_Pgp_Element_Message
$text string The text to be encrypted.
$keys mixed The list of public keys to encrypt.
$opts array Additional options: - cipher: (string) Default symmetric cipher algorithm to use. One of: 3DES, CAST5, AES128, AES192, AES256, Twofish. - compress: (string) Default compression to use. One of: NONE, ZIP, ZLIB
return Horde_Pgp_Element_Message The encrypted data.

encryptSymmetric() public method

Encrypts text using a PGP symmetric passphrase.
public encryptSymmetric ( string $text, mixed $passphrase, array $opts = [] ) : Horde_Pgp_Element_Message
$text string The text to be encrypted.
$passphrase mixed The symmetric passphrase(s).
$opts array Additional options: - cipher: (string) Default symmetric cipher algorithm to use. One of: 3DES, CAST5, AES128, AES192, AES256, Twofish. - compress: (string) Default compression to use. One of: NONE, ZIP, ZLIB
return Horde_Pgp_Element_Message The encrypted data.

generateKey() public method

Generates a private key.
public generateKey ( string $name, string $email, array $opts = [] ) : Horde_Pgp_Key_Private
$name string Full name.
$email string E-mail.
$opts array Additional options: - comment: (string) Comment. - hash: (string) Hash function. - expire: (integer) Expiration date (UNIX timestamp). - keylength: (integer) Key length. - passphrase: (string) Passphrase.
return Horde_Pgp_Key_Private The generated private key.

sign() public method

Returns message object that contains both the signed data and the signature packet.
public sign ( string $text, mixed $key, array $opts = [] ) : Horde_Pgp_Element_Message
$text string The text to be signed.
$key mixed The private key to use for signing (must be decrypted).
$opts array Additional options: - compress: (string) Default compression to use. One of: NONE, ZIP, ZLIB - sign_hash: (string) The hash method to use.
return Horde_Pgp_Element_Message The signed data.

signCleartext() public method

Sign data using a PGP private key, creating cleartext output.
public signCleartext ( string $text, mixed $key, array $opts = [] ) : Horde_Pgp_Element_SignedMessage
$text string The text to be signed.
$key mixed The private key to use for signing (must be decrypted).
$opts array Additional options: - sign_hash: (string) The hash method to use.
return Horde_Pgp_Element_SignedMessage The signed data.

signDetached() public method

Sign data using a PGP private key, returning a detached signature.
public signDetached ( string $text, mixed $key, array $opts = [] ) : Horde_Pgp_Element_Signature
$text string The text to be signed.
$key mixed The private key to use for signing (must be decrypted).
$opts array Additional options: - sign_hash: (string) The hash method to use.
return Horde_Pgp_Element_Signature The detached signature.

verify() public method

Verifies text using a PGP public key.
public verify ( mixed $text, mixed $key ) : array
$text mixed The text to be verified
$key mixed The public key used for signing.
return array List of verified packets. Each sub array contains two values: the list of packets verfied by signing and the list of signature packets used to verify.

verifyDetached() public method

Verifies text using a PGP public key and a detached signature.
public verifyDetached ( mixed $text, mixed $sig, mixed $key ) : {
$text mixed The text to be verified
$sig mixed The detached signature.
$key mixed The public key used for signing.
return {

Property Details

$_backends protected_oe property

List of initialized backends.
protected array $_backends
return array

$_params protected_oe property

Configuration parameters.
protected array $_params
return array