Horde_Pgp_Mime
extends Horde_Pgp
in package
Extend the PGP object to produce MIME PGP data (RFC 3156).
Tags
Table of Contents
- PGP_ARMOR = 'pgp_armor'
- PGP_CHARSET = 'pgp_charset'
- $_backends : array<string|int, mixed>
- List of initialized backends.
- $_params : array<string|int, mixed>
- Configuration parameters.
- __construct() : mixed
- Constructor.
- armorToPart() : mixed
- Converts armored input into a Horde_Mime_Part object.
- decrypt() : Horde_Pgp_Element_Message
- Decrypts text using a PGP private key.
- decryptSymmetric() : array<string|int, mixed>
- Decrypts text using a PGP symmetric passphrase.
- encrypt() : Horde_Pgp_Element_Message
- Encrypts text using PGP public keys.
- encryptPart() : Horde_Mime_Part
- Encrypts a MIME part using PGP.
- encryptSymmetric() : Horde_Pgp_Element_Message
- Encrypts text using a PGP symmetric passphrase.
- generateKey() : Horde_Pgp_Key_Private
- Generates a private key.
- publicKeyPart() : Horde_Mime_Part
- Generate a Horde_Mime_Part object that contains a public key (RFC 3156 [7]).
- sign() : Horde_Pgp_Element_Message
- Sign data using a PGP private key.
- signAndEncryptPart() : Horde_Mime_Part
- Signs and encrypts a MIME part using PGP.
- signCleartext() : Horde_Pgp_Element_SignedMessage
- Sign data using a PGP private key, creating cleartext output.
- signDetached() : Horde_Pgp_Element_Signature
- Sign data using a PGP private key, returning a detached signature.
- signPart() : Horde_Mime_Part
- Signs a MIME part using PGP.
- verify() : array<string|int, mixed>
- Verifies text using a PGP public key.
- verifyDetached() : mixed
- Verifies text using a PGP public key and a detached signature.
- _encryptBase() : Horde_Mime_Part
- Create the base MIME part used for encryption (RFC 3156 [4]).
- _encryptPart() : Horde_Mime_Part
- Create the base MIME part used for encryption (RFC 3156 [4]).
- _getCipher() : mixed
- TODO
- _getCompression() : mixed
- TODO
- _getOption() : mixed
- TODO
- _getPrivateKey() : mixed
- TODO
- _initDrivers() : mixed
- Initialize the backend driver list.
- _runInBackend() : mixed
- TODO
- _signPart() : mixed
Constants
PGP_ARMOR
public
mixed
PGP_ARMOR
= 'pgp_armor'
PGP_CHARSET
public
mixed
PGP_CHARSET
= 'pgp_charset'
Properties
$_backends
List of initialized backends.
protected
array<string|int, mixed>
$_backends
= array()
$_params
Configuration parameters.
protected
array<string|int, mixed>
$_params
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $params : array<string|int, mixed> = array()
-
Configuration parameters:
- backends: (array) The explicit list of backend drivers (Horde_Pgp_Backend objects) to use.
Return values
mixed —armorToPart()
Converts armored input into a Horde_Mime_Part object.
public
armorToPart(mixed $input[, array<string|int, mixed> $opts = array() ]) : mixed
Parameters
- $input : mixed
-
Armored input.
- $opts : array<string|int, mixed> = array()
-
Additional options:
- charset: (string) Charset of the armored input.
Return values
mixed —Either null if no PGP data was found, or a Horde_Mime_Part object.
decrypt()
Decrypts text using a PGP private key.
public
decrypt(mixed $text, mixed $key) : Horde_Pgp_Element_Message
Parameters
- $text : mixed
-
The text to be decrypted.
- $key : mixed
-
The private key to use for decryption (must be decrypted).
Tags
Return values
Horde_Pgp_Element_Message —$msg The decrypted message.
decryptSymmetric()
Decrypts text using a PGP symmetric passphrase.
public
decryptSymmetric(mixed $text, string $passphrase) : array<string|int, mixed>
Parameters
- $text : mixed
-
The text to be decrypted.
- $passphrase : string
-
The symmetric passphrase used to encrypt the data.
Tags
Return values
array<string|int, mixed> —$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()
Encrypts text using PGP public keys.
public
encrypt(string $text, mixed $keys[, array<string|int, mixed> $opts = array() ]) : Horde_Pgp_Element_Message
Parameters
- $text : string
-
The text to be encrypted.
- $keys : mixed
-
The list of public keys to encrypt.
- $opts : array<string|int, mixed> = 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
Tags
Return values
Horde_Pgp_Element_Message —The encrypted data.
encryptPart()
Encrypts a MIME part using PGP.
public
encryptPart(Horde_Mime_Part $part[, array<string|int, mixed> $opts = array() ]) : Horde_Mime_Part
Parameters
- $part : Horde_Mime_Part
-
The object to encrypt.
- $opts : array<string|int, mixed> = array()
-
Additional options:
- cipher: (string) Default symmetric cipher algorithm to use.
- compress: (string) Default compression algorithm.
- pubkeys: (mixed) The public key(s) to use for encryption.
- symmetric: (string) If set, use as symmetric key.
Tags
Return values
Horde_Mime_Part —An encrypted object.
encryptSymmetric()
Encrypts text using a PGP symmetric passphrase.
public
encryptSymmetric(string $text, mixed $passphrase[, array<string|int, mixed> $opts = array() ]) : Horde_Pgp_Element_Message
Parameters
- $text : string
-
The text to be encrypted.
- $passphrase : mixed
-
The symmetric passphrase(s).
- $opts : array<string|int, mixed> = 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
Tags
Return values
Horde_Pgp_Element_Message —The encrypted data.
generateKey()
Generates a private key.
public
generateKey(string $name, string $email[, array<string|int, mixed> $opts = array() ]) : Horde_Pgp_Key_Private
Parameters
- $name : string
-
Full name.
- $email : string
-
E-mail.
- $opts : array<string|int, mixed> = array()
-
Additional options:
- comment: (string) Comment.
- hash: (string) Hash function.
- expire: (integer) Expiration date (UNIX timestamp).
- keylength: (integer) Key length.
- passphrase: (string) Passphrase.
Tags
Return values
Horde_Pgp_Key_Private —The generated private key.
publicKeyPart()
Generate a Horde_Mime_Part object that contains a public key (RFC 3156 [7]).
public
publicKeyPart(mixed $key) : Horde_Mime_Part
Parameters
- $key : mixed
-
The public key.
Return values
Horde_Mime_Part —An object that contains the public key.
sign()
Sign data using a PGP private key.
public
sign(string $text, mixed $key[, array<string|int, mixed> $opts = array() ]) : Horde_Pgp_Element_Message
Returns message object that contains both the signed data and the signature packet.
Parameters
- $text : string
-
The text to be signed.
- $key : mixed
-
The private key to use for signing (must be decrypted).
- $opts : array<string|int, mixed> = array()
-
Additional options:
- compress: (string) Default compression to use. One of: NONE, ZIP, ZLIB
- sign_hash: (string) The hash method to use.
Tags
Return values
Horde_Pgp_Element_Message —The signed data.
signAndEncryptPart()
Signs and encrypts a MIME part using PGP.
public
signAndEncryptPart(Horde_Mime_Part $part, mixed $privkey[, array<string|int, mixed> $opts = array() ]) : Horde_Mime_Part
Parameters
- $part : Horde_Mime_Part
-
The part to sign and encrypt.
- $privkey : mixed
-
The private key to use for signing (must be decrypted).
- $opts : array<string|int, mixed> = array()
-
Additional options:
- cipher: (string) Default symmetric cipher algorithm to use.
- compress: (string) Default compression algorithm.
- pubkeys: (mixed) The public key(s) to use for encryption.
- symmetric: (string) If set, use as symmetric key.
Tags
Return values
Horde_Mime_Part —A signed and encrypted part.
signCleartext()
Sign data using a PGP private key, creating cleartext output.
public
signCleartext(string $text, mixed $key[, array<string|int, mixed> $opts = array() ]) : Horde_Pgp_Element_SignedMessage
Parameters
- $text : string
-
The text to be signed.
- $key : mixed
-
The private key to use for signing (must be decrypted).
- $opts : array<string|int, mixed> = array()
-
Additional options:
- sign_hash: (string) The hash method to use.
Tags
Return values
Horde_Pgp_Element_SignedMessage —The signed data.
signDetached()
Sign data using a PGP private key, returning a detached signature.
public
signDetached(string $text, mixed $key[, array<string|int, mixed> $opts = array() ]) : Horde_Pgp_Element_Signature
Parameters
- $text : string
-
The text to be signed.
- $key : mixed
-
The private key to use for signing (must be decrypted).
- $opts : array<string|int, mixed> = array()
-
Additional options:
- sign_hash: (string) The hash method to use.
Tags
Return values
Horde_Pgp_Element_Signature —The detached signature.
signPart()
Signs a MIME part using PGP.
public
signPart(Horde_Mime_Part $part, mixed $key[, array<string|int, mixed> $opts = array() ]) : Horde_Mime_Part
Parameters
- $part : Horde_Mime_Part
-
The object to sign.
- $key : mixed
-
The private key to use for signing (must be decrypted).
- $opts : array<string|int, mixed> = array()
-
Additional options:
- compress: (string) Default compression algorithm.
Tags
Return values
Horde_Mime_Part —A signed object.
verify()
Verifies text using a PGP public key.
public
verify(mixed $text, mixed $key) : array<string|int, mixed>
Parameters
- $text : mixed
-
The text to be verified
- $key : mixed
-
The public key used for signing.
Tags
Return values
array<string|int, mixed> —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()
Verifies text using a PGP public key and a detached signature.
public
verifyDetached(mixed $text, mixed $sig, mixed $key) : mixed
Parameters
- $text : mixed
-
The text to be verified
- $sig : mixed
-
The detached signature.
- $key : mixed
-
The public key used for signing.
Tags
Return values
mixed —_encryptBase()
Create the base MIME part used for encryption (RFC 3156 [4]).
protected
_encryptBase(Horde_Pgp_Element_Message $encrypted) : Horde_Mime_Part
Parameters
- $encrypted : Horde_Pgp_Element_Message
-
Encrypted data.
Return values
Horde_Mime_Part —Base encrypted MIME part.
_encryptPart()
Create the base MIME part used for encryption (RFC 3156 [4]).
protected
_encryptPart(mixed $data, mixed $opts) : Horde_Mime_Part
Parameters
- $data : mixed
- $opts : mixed
Return values
Horde_Mime_Part —Base encrypted MIME part.
_getCipher()
TODO
protected
_getCipher(mixed $opts, mixed $default) : mixed
Parameters
- $opts : mixed
- $default : mixed
Return values
mixed —_getCompression()
TODO
protected
_getCompression(mixed $opts, mixed $default) : mixed
Parameters
- $opts : mixed
- $default : mixed
Return values
mixed —_getOption()
TODO
protected
_getOption(mixed $opts, mixed $default, mixed $name, mixed $map) : mixed
Parameters
- $opts : mixed
- $default : mixed
- $name : mixed
- $map : mixed
Return values
mixed —_getPrivateKey()
TODO
protected
_getPrivateKey(mixed $key) : mixed
Parameters
- $key : mixed
Return values
mixed —_initDrivers()
Initialize the backend driver list.
protected
_initDrivers() : mixed
Return values
mixed —_runInBackend()
TODO
protected
_runInBackend(mixed $cmd, mixed $args, mixed $error) : mixed
Parameters
- $cmd : mixed
- $args : mixed
- $error : mixed
Return values
mixed —_signPart()
protected
_signPart(mixed $part, mixed $detach_sig) : mixed
Parameters
- $part : mixed
- $detach_sig : mixed