openssl_pkcs7_encrypt
string$input_filename,
string$output_filename,
OpenSSLCertificate|array|string$certificate,
array|null$headers,
[int$flags = 0],
[int$cipher_algo = OPENSSL_CIPHER_AES_128_CBC]
): bool
openssl_pkcs7_encrypt takes the contents of the file named input_filename and encrypts them using an RC2 40-bit cipher so that they can only be read by the intended recipients specified by certificate.
Parameters
- input_filename
-
- output_filename
-
- certificate
-
Either a lone X.509 certificate, or an array of X.509 certificates.
- headers
-
headers is an array of headers that will be prepended to the data after it has been encrypted.
headers can be either an associative array keyed by header name, or an indexed array, where each element contains a single header line.
- flags
-
flags can be used to specify options that affect the encoding process - see PKCS7 constants.
- cipher_algo
-
One of cipher constants.
Return Values
Returns true on success or false on failure.
Changelog
Version | Description |
8.1.0 | The default cipher algorithm (cipher_algo) is now AES-128-CBC (OPENSSL_CIPHER_AES_128_CBC). Previously, PKCS7/CMS was used (OPENSSL_CIPHER_RC2_40). |
8.0.0 | certificate accepts an OpenSSLCertificate instance now; previously, a resource of type OpenSSL X.509 CSR was accepted. |