Метод | Описание | |
---|---|---|
__construct ( array $params = [] ) | Constructor. | |
certToHTML ( string $cert ) : string | Convert a PEM format certificate to readable HTML version. | |
checkForOpenSSL ( ) | Check for the presence of the OpenSSL extension to PHP. | |
decrypt ( string $text, array $params = [] ) : string | Decrypt text via S/MIME. | |
encrypt ( string $text, array $params = [] ) : string | Encrypt text using S/MIME. | |
encryptMIMEPart ( Horde_Mime_Part $mime_part, array $params = [] ) : Horde_Mime_Part | Encrypt a MIME part using S/MIME. This produces S/MIME Version 3.2 compatible data (see RFC 5751 [3.3]). | |
extractSignedContents ( string $data, string $sslpath ) : string | Extract the contents from signed S/MIME data. | |
getEmailFromKey ( string $key ) : mixed | Extract the email address from a public key. | |
parseCert ( string $cert ) : array | Extract the contents of a PEM format certificate to an array. | |
parsePKCS12Data ( string $pkcs12, array $params ) : stdClass | Convert a PKCS 12 encrypted certificate package into a private key, public key, and any additional keys. | |
signAndEncryptMIMEPart ( Horde_Mime_Part $mime_part, array $sign_params = [], array $encrypt_params = [] ) : mixed | Sign and Encrypt a MIME part using S/MIME. | |
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]). | |
verify ( string $text, mixed $certs ) : stdClass | Verify a signature using via S/MIME. | |
verifyPassphrase ( string $private_key, string $passphrase ) : boolean | Verify a passphrase for a given private key. |
Метод | Описание | |
---|---|---|
_createTempFile ( string $descrip = 'horde-crypt', boolean $delete = true ) : string | Create a temporary file that will be deleted at the end of this process. | |
_decryptMessage ( string $text, array $params ) : string | Decrypt an S/MIME encrypted message using a private/public keypair and a passhprase. | |
_decryptSignature ( string $text, array $params ) : string | Decrypt an S/MIME signed message using a public key. | |
_encryptMessage ( string $text, array $params ) : string | Encrypt a message in S/MIME format using a public key. | |
_encryptSignature ( string $text, array $params ) : string | Sign a message in S/MIME format using a private key. | |
_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). | |
_implodeValues ( array | string $value, integer $indent = 4 ) : string | Formats a multi-value cert field. |
public __construct ( array $params = [] ) | ||
$params | array | Configuration parameters: - temp: (string) Location of temporary directory. |
protected _decryptMessage ( string $text, array $params ) : string | ||
$text | string | The text to be decrypted. |
$params | array | The parameters needed for decryption.
Parameters: =========== 'type' => 'message' (REQUIRED) 'pubkey' => public key. (REQUIRED) 'privkey' => private key. (REQUIRED) 'passphrase' => Passphrase for Key. (REQUIRED) |
Результат | string | The decrypted message. |
protected _encryptMessage ( string $text, array $params ) : string | ||
$text | string | The text to be encrypted. |
$params | array | The parameters needed for encryption. - type: (string) [REQUIRED] 'message'. - pubkey: (mixed) [REQUIRED] Public key/cert or array of public keys/certs. |
Результат | string | The encrypted message. |
protected _encryptSignature ( string $text, array $params ) : string | ||
$text | string | The text to be signed. |
$params | array | The (string) parameters needed for signing: - 'certs': Additional signing certs (Optional) - 'passphrase': Passphrase for key (REQUIRED) - 'privkey': Private key (REQUIRED) - 'pubkey': Public key (REQUIRED) - 'sigtype': Determine the signature type to use. (Optional): - 'cleartext': Make a clear text signature - 'detach': Make a detached signature (DEFAULT) - 'type': 'signature' (REQUIRED) |
Результат | string | The signed message. |
public certToHTML ( string $cert ) : string | ||
$cert | string | PEM format certificate. |
Результат | string | HTML detailing the certificate. |
public checkForOpenSSL ( ) |
public encryptMIMEPart ( Horde_Mime_Part $mime_part, array $params = [] ) : Horde_Mime_Part | ||
$mime_part | Horde_Mime_Part | The object to encrypt. |
$params | array | The parameters required for encryption. |
Результат | Horde_Mime_Part | An encrypted MIME part object. |
public getEmailFromKey ( string $key ) : mixed | ||
$key | string | The public key. |
Результат | mixed | Returns the first email address found, or null if there are none. |
public parsePKCS12Data ( string $pkcs12, array $params ) : stdClass | ||
$pkcs12 | string | The PKCS 12 data. |
$params | array | 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) |
Результат | stdClass | An object. 'private' - The private key in PEM format. 'public' - The public key in PEM format. 'certs' - An array of additional certs. |
public signAndEncryptMIMEPart ( Horde_Mime_Part $mime_part, array $sign_params = [], array $encrypt_params = [] ) : mixed | ||
$mime_part | Horde_Mime_Part | The object to sign and encrypt. |
$sign_params | array | The parameters required for signing. @see _encryptSignature(). |
$encrypt_params | array | The parameters required for encryption. @see _encryptMessage(). |
Результат | mixed | A Horde_Mime_Part object that is signed and encrypted. |
public signMIMEPart ( Horde_Mime_Part $mime_part, array $params ) : Horde_Mime_Part | ||
$mime_part | Horde_Mime_Part | The object to sign. |
$params | array | The parameters required for signing. |
Результат | Horde_Mime_Part | A signed MIME part object. |
public verify ( string $text, mixed $certs ) : stdClass | ||
$text | string | The multipart/signed data to be verified. |
$certs | mixed | Either a single or array of root certificates. |
Результат | stdClass | 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. |