Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

openssl_pkcs7_encrypt(3) [php man page]

OPENSSL_PKCS7_ENCRYPT(3)						 1						  OPENSSL_PKCS7_ENCRYPT(3)

openssl_pkcs7_encrypt - Encrypt an S/MIME message

SYNOPSIS
bool openssl_pkcs7_encrypt (string $infile, string $outfile, mixed $recipcerts, array $headers, [int $flags], [int $cipherid = OPENSSL_CIPHER_RC2_40]) DESCRIPTION
openssl_pkcs7_encrypt(3) 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. PARAMETERS
o $infile - o $outfile - o $recipcerts - Either a lone X.509 certificate, or an array of X.509 certificates. o $headers -$headers is an array of headers that will be prepended to the data after it has been encrypted. $headers can be either an asso- ciative array keyed by header name, or an indexed array, where each element contains a single header line. o $flags -$flags can be used to specify options that affect the encoding process - see PKCS7 constants. o $cipherid - One of cipher constants. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 openssl_pkcs7_encrypt(3) 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! HQ EOD; // load key $key = file_get_contents("nighthawk.pem"); // save message to file $fp = fopen("msg.txt", "w"); fwrite($fp, $data); fclose($fp); // encrypt it if (openssl_pkcs7_encrypt("msg.txt", "enc.txt", $key, array("To" => "nighthawk@example.com", // keyed syntax "From: HQ <hq@example.com>", // indexed syntax "Subject" => "Eyes only"))) { // message encrypted - send it! exec(ini_get("sendmail_path") . " < enc.txt"); } ?> PHP Documentation Group OPENSSL_PKCS7_ENCRYPT(3)

Check Out this Related Man Page

SOAPCLIENT.__SETSOAPHEADERS(3)						 1					    SOAPCLIENT.__SETSOAPHEADERS(3)

SoapClient::__setSoapHeaders - Sets SOAP headers for subsequent calls

SYNOPSIS
public bool SoapClient::__setSoapHeaders ([mixed $soapheaders]) DESCRIPTION
Defines headers to be sent along with the SOAP requests. Note Calling this method will replace any previous values. PARAMETERS
o $soapheaders - The headers to be set. It could be SoapHeader object or array of SoapHeader objects. If not specified or set to NULL, the head- ers will be deleted. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 SoapClient.__setSoapHeaders(3) example <?php $client = new SoapClient(null, array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $header = new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world'); $client->__setSoapHeaders($header); $client->__soapCall("echoVoid", null); ?> Example #2 Set Multiple Headers <?php $client = new SoapClient(null, array('location' => "http://localhost/soap.php", 'uri' => "http://test-uri/")); $headers = array(); $headers[] = new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world'); $headers[] = new SoapHeader('http://soapinterop.org/echoheader/', 'echoMeStringRequest', 'hello world again'); $client->__setSoapHeaders($headers); $client->__soapCall("echoVoid", null); ?> PHP Documentation Group SOAPCLIENT.__SETSOAPHEADERS(3)
Man Page