$_params
$_params : array
Configuration parameters.
Library to interact with the OpenSSL library and implement S/MIME.
factory(string $driver, array $params = array()) : \Horde_Crypt
Attempts to return a concrete Horde_Crypt instance based on $driver.
string | $driver | Either a driver name, or the full class name to use (class must extend Horde_Crypt). |
array | $params | A hash containing any additional configuration or parameters a subclass might need. |
The newly created concrete instance.
encrypt(string $text, array $params = array()) : string
Encrypt text using S/MIME.
This method should be provided by all classes that extend Horde_Crypt.
string | $text | The text to be encrypted. |
array | $params | The parameters needed for encryption. See the individual _encrypt*() functions for the parameter requirements. |
The encrypted message.
decrypt(string $text, array $params = array()) : string
Decrypt text via S/MIME.
This method should be provided by all classes that extend Horde_Crypt.
string | $text | The text to be smime decrypted. |
array | $params | The parameters needed for decryption. See the individual _decrypt*() functions for the parameter requirements. |
The decrypted message.
verifyPassphrase(string $private_key, string $passphrase) : boolean
Verify a passphrase for a given private key.
string | $private_key | The user's private key. |
string | $passphrase | The user's passphrase. |
Returns true on valid passphrase, false on invalid passphrase.
verify(string $text, mixed $certs) : \stdClass
Verify a signature using via S/MIME.
string | $text | The multipart/signed data to be verified. |
mixed | $certs | Either a single or array of root certificates. |
Object with the following elements:
cert - (string) The certificate of the signer stored in the message (in PEM format). email - (string) The email of the signing person. msg - (string) Status string. verify - (boolean) True if certificate was verified.
extractSignedContents(string $data, string $sslpath = null) : string
Extract the contents from signed S/MIME data.
string | $data | The signed S/MIME data. |
string | $sslpath | The path to the OpenSSL binary. @deprecated and not used, just for backwards-compatibility. |
The contents embedded in the signed data.
signMIMEPart(\Horde_Mime_Part $mime_part, array $params) : \Horde_Mime_Part
Sign a MIME part using S/MIME. This produces S/MIME Version 3.2 compatible data (see RFC 5751 [3.4]).
\Horde_Mime_Part | $mime_part | The object to sign. |
array | $params | The parameters required for signing. |
A signed MIME part object.
encryptMIMEPart(\Horde_Mime_Part $mime_part, array $params = array()) : \Horde_Mime_Part
Encrypt a MIME part using S/MIME. This produces S/MIME Version 3.2 compatible data (see RFC 5751 [3.3]).
\Horde_Mime_Part | $mime_part | The object to encrypt. |
array | $params | The parameters required for encryption. |
An encrypted MIME part object.
signAndEncryptMIMEPart(\Horde_Mime_Part $mime_part, array $sign_params = array(), array $encrypt_params = array()) : mixed
Sign and Encrypt a MIME part using S/MIME.
\Horde_Mime_Part | $mime_part | The object to sign and encrypt. |
array | $sign_params | The parameters required for signing. @see _encryptSignature(). |
array | $encrypt_params | The parameters required for encryption. @see _encryptMessage(). |
A Horde_Mime_Part object that is signed and encrypted.
parsePKCS12Data(string $pkcs12, array $params) : \stdClass
Convert a PKCS 12 encrypted certificate package into a private key, public key, and any additional keys.
string | $pkcs12 | The PKCS 12 data. |
array | $params | The parameters needed for parsing. Parameters: =========== 'sslpath' => The path to the OpenSSL binary. (REQUIRED) 'password' => The password to use to decrypt the data. (Optional) 'newpassword' => The password to use to encrypt the private key. (Optional) |
An object. 'private' - The private key in PEM format. 'public' - The public key in PEM format. 'certs' - An array of additional certs.
_encryptMessage(string $text, array $params) : string
Encrypt a message in S/MIME format using a public key.
string | $text | The text to be encrypted. |
array | $params | The parameters needed for encryption.
|
The encrypted message.
_encryptSignature(string $text, array $params) : string
Sign a message in S/MIME format using a private key.
string | $text | The text to be signed. |
array | $params | The (string) parameters needed for signing:
|
The signed message.
_decryptMessage(string $text, array $params) : string
Decrypt an S/MIME encrypted message using a private/public keypair and a passhprase.
string | $text | The text to be decrypted. |
array | $params | The parameters needed for decryption. Parameters: =========== 'type' => 'message' (REQUIRED) 'pubkey' => public key. (REQUIRED) 'privkey' => private key. (REQUIRED) 'passphrase' => Passphrase for Key. (REQUIRED) |
The decrypted message.
_decryptSignature(string $text, array $params) : string
Decrypt an S/MIME signed message using a public key.
string | $text | The text to be verified. |
array | $params | The parameters needed for verification. |
The verification message.
_fixContentType(string $text, string $type) : string
The Content-Type parameters PHP's openssl_pkcs7_* functions return are deprecated. Fix these headers to the correct ones (see RFC 2311).
string | $text | The PKCS7 data. |
string | $type | Is this 'message' or 'signature' data? |
The PKCS7 data with the correct Content-Type parameter.
_createTempFile(string $descrip = 'horde-crypt', boolean $delete = true) : string
Create a temporary file that will be deleted at the end of this process.
string | $descrip | Description string to use in filename. |
boolean | $delete | Delete the file automatically? |
Filename of a temporary file.