openssl_pkcs7_encrypt -- Encrypt an S/MIME message
Syntax
bool openssl_pkcs7_encrypt ( string infile, string outfile, mixed recipcerts, array headers [, int flags [, int cipherid]] )
openssl_pkcs7_encrypt() takes the contents of the
file named infile and encrypts them using an RC2
40-bit cipher so that they can only be read by the intended recipients
specified by recipcerts, which is either a
lone X.509 certificate, or an array of X.509 certificates.
headers is an array of headers that
will be prepended to the data after it has been encrypted.
flags can be used to specify options that affect
the encoding process - see PKCS7
constants.
headers can be either an associative array
keyed by header name, or an indexed array, where each element contains
a single header line.
Cipher can be selected with cipherid since PHP 5.
Example 1. openssl_pkcs7_encrypt() example
<?php // the message you want to encrypt and send to your secret agent // in the field, known as nighthawk. You have his certificate // in the file nighthawk.pem $data = <<<EOD Nighthawk,
Top secret, for your eyes only!
The enemy is closing in! Meet me at the cafe at 8.30am to collect your forged passport!
openssl pkcs7 encrypt php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online
Php openssl pkcs7 encrypt syntax tutorial
php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.