PHP Class Horde_Crypt_Pgp_Backend, 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])
Show file Open project: horde/horde

Public Methods

Method Description
decryptMessage ( string $text, array $params ) : object Decrypts an PGP encrypted message using a private/public keypair and a passhprase.
decryptSignature ( string $text, array $params ) : object Decrypts an PGP signed message using a public key.
encryptMessage ( string $text, array $params ) : string Encrypts a message in PGP format using a public key.
encryptSignature ( string $text, array $params ) : string Signs a message in PGP format using a private key.
generateKey ( array $opts ) : mixed Generates a personal public/private keypair combination.
getFingerprintsFromKey ( string $pgpdata ) : array Get the fingerprints from a key block.
getPublicKeyFromPrivateKey ( string $data ) : string Generates a public key from a private key.
getSignersKeyId ( string $text ) : mixed Returns the key ID of the key used to sign a block of PGP data.
isEncryptedSymmetrically ( string $text ) : boolean Returns whether a text has been encrypted symmetrically.
packetInfo ( string $pgpdata ) : array Returns information on a PGP data block.
packetInfoMultiple ( string $pgpdata ) : array Returns all information on a PGP data block.
supported ( ) : boolean Is this driver supported?

Method Details

decryptMessage() public method

Decrypts an PGP encrypted message using a private/public keypair and a passhprase.
public decryptMessage ( string $text, array $params ) : object
$text string The text to be decrypted.
$params array The parameters needed for decryption. - no_passphrase: Passphrase is not required. - passphrase: Passphrase for PGP Key. (REQUIRED, see no_passphrase) - privkey: PGP private key. (REQUIRED for asymmetric encryption) - pubkey: PGP public key. (REQUIRED for asymmetric encryption) - type: [REQUIRED] 'message'
return object An object with the following properties: - message: (string) The signature result text. - result: (boolean) The result of the signature test.

decryptSignature() public method

Decrypts an PGP signed message using a public key.
public decryptSignature ( string $text, array $params ) : object
$text string The text to be verified.
$params array The parameters needed for verification. - charset: Charset of the message body. - pubkey: [REQUIRED] PGP public key. - signature: PGP signature block. (REQUIRED for detached signature) - type: [REQUIRED] 'signature' or 'detached-signature'
return object An object with the following properties: - message: (string) The signature result text. - result: (boolean) The result of the signature test.

encryptMessage() public method

Encrypts a message in PGP format using a public key.
public encryptMessage ( string $text, array $params ) : string
$text string The text to be encrypted.
$params array The parameters needed for encryption. - passphrase: The passphrase for the symmetric encryption (REQUIRED if 'symmetric' is true) - recips: An array with the e-mail address of the recipient as the key and that person's public key as the value. (REQUIRED if 'symmetric' is false) - symmetric: Whether to use symmetric instead of asymmetric encryption (defaults to false). - type: [REQUIRED] 'message'
return string The encrypted message.

encryptSignature() public method

Signs a message in PGP format using a private key.
public encryptSignature ( string $text, array $params ) : string
$text string The text to be signed.
$params array The parameters needed for signing. - passphrase: [REQUIRED] Passphrase for PGP Key. - privkey: [REQUIRED] PGP private key. - pubkey: [REQUIRED] PGP public key. - sigtype: Determine the signature type to use. - 'cleartext': Make a clear text signature - 'detach': Make a detached signature (DEFAULT) - type: [REQUIRED] 'signature'
return string The signed message.

generateKey() public method

Generates a personal public/private keypair combination.
public generateKey ( array $opts ) : mixed
$opts array Configuration: - comment: (string) The comment to use. - email: (string) The email to use. - expire: (integer) The expiration date (UNIX timestamp). No expiration if empty. - keylength: (integer) The keylength to use. - key_type: (string) Key type. - name: (string) The name to use. - passphrase: (string) The passphrase to use. - subkey_type: (string) Subkey type.
return mixed False on error; an array on success consisting of the following keys/values: - private: (string) Private key. - public: (string) Public key.

getFingerprintsFromKey() public method

Get the fingerprints from a key block.
public getFingerprintsFromKey ( string $pgpdata ) : array
$pgpdata string The PGP data block.
return array The fingerprints in $pgpdata indexed by key id.

getPublicKeyFromPrivateKey() public method

Generates a public key from a private key.
public getPublicKeyFromPrivateKey ( string $data ) : string
$data string Armor text of private key.
return string Armor text of public key.

getSignersKeyId() public method

Returns the key ID of the key used to sign a block of PGP data.
public getSignersKeyId ( string $text ) : mixed
$text string The PGP signed text block.
return mixed The key ID of the key used to sign $text.

isEncryptedSymmetrically() public method

Returns whether a text has been encrypted symmetrically.
public isEncryptedSymmetrically ( string $text ) : boolean
$text string The PGP encrypted text.
return boolean True if the text is symmetrically encrypted.

packetInfo() public method

Returns information on a PGP data block.
public packetInfo ( string $pgpdata ) : array
$pgpdata string The PGP data block.
return array An array with information on the PGP data block. {@see \Horde_Crypt_Pgp::pgpPacketInformation()}

packetInfoMultiple() public method

Returns all information on a PGP data block.
public packetInfoMultiple ( string $pgpdata ) : array
$pgpdata string The PGP data block.
return array An array with information on the PGP data block. {@see \Horde_Crypt_Pgp::pgpPacketInformationMultiple()}

supported() public static method

Is this driver supported?
public static supported ( ) : boolean
return boolean True if supported.