\Horde_Pgp_Backend

Abstract backend class to implement PGP functionality.

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.

Summary

Methods
Properties
Constants
supported()
generateKey()
encrypt()
encryptSymmetric()
sign()
decrypt()
decryptSymmetric()
verify()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

supported()

supported() : boolean

Is this driver supported?

Returns

boolean —

True if supported.

generateKey()

generateKey(array  $opts) : \Horde_Pgp_Key_Private

Generates a private key.

Parameters

array $opts

Configuration:

  • comment: (string) The comment to use.
  • email: (string) The email to use.
  • expire: (integer) Expiration date (UNIX timestamp).
  • hash: (string) Hash function (DEFAULT: SHA256).
  • keylength: (integer) The keylength to use.
  • name: (string) The name to use.
  • passphrase: (string) The passphrase to use.

Returns

\Horde_Pgp_Key_Private —

The generated private key.

encrypt()

encrypt(string  $text, array  $keys, array  $opts) : \Horde_Pgp_Element_Message

Encrypts text using PGP public keys.

Parameters

string $text

The text to be PGP encrypted.

array $keys

The list of public keys to encrypt (Horde_Pgp_Element_PublicKey objects).

array $opts

Additional options:

  • cipher: (integer) Symmetric cipher algorithm.
  • compress: (boolean) Compression algorithm.

Returns

\Horde_Pgp_Element_Message

The encrypted message.

encryptSymmetric()

encryptSymmetric(string  $text, array  $passphrase, array  $opts) : \Horde_Pgp_Element_Message

Encrypts text using a PGP symmetric passphrase.

Parameters

string $text

The text to be PGP encrypted.

array $passphrase

The symmetric passphrase(s).

array $opts

Additional options:

  • cipher: (integer) Symmetric cipher algorithm.
  • compress: (boolean) Compression algorithm.

Returns

\Horde_Pgp_Element_Message

The encrypted message.

sign()

sign(string  $text, \Horde_Pgp_Element_PrivateKey  $key, integer  $mode, array  $opts = array()) : mixed

Sign a message using a PGP private key.

Parameters

string $text

The text to be PGP signed.

\Horde_Pgp_Element_PrivateKey $key

The private key to use for signing.

integer $mode

The signing mode. Either 'clear', 'detach', or 'message'.

array $opts

Additional options:

  • compress: (boolean) Compression algorithm.
  • sign_hash: (string) The hash method to use.

Returns

mixed —

The signed message.

decryptSymmetric()

decryptSymmetric(\Horde_Pgp_Element_Message  $msg, string  $passphrase) : \Horde_Pgp_Element_Message

Decrypts text using a PGP symmetric passphrase.

Parameters

\Horde_Pgp_Element_Message $msg

The message to be decrypted.

string $passphrase

The symmetric passphrase used to encrypt the data.

Returns

\Horde_Pgp_Element_Message

The decrypted message.

verify()

verify(\Horde_Pgp_Element  $msg, \Horde_Pgp_Element_PublicKey  $key) : array

Verifies data using a PGP public key.

Parameters

\Horde_Pgp_Element $msg

The text to be verified.

\Horde_Pgp_Element_PublicKey $key

Public key used for signing.

Returns

array —

{@see Horde_Pgp#verify()}.