Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

openssl pkcs7 sign function syntax tag tutorial 2013





Alert! Connect with 10,000 Chating Online. Join Now

Php openssl pkcs7 sign () function

Write your php code

 
<?php ?>

Php Result


Your code below



(PHP 4 >= 4.0.6, PHP 5)

openssl_pkcs7_sign -- Sign an S/MIME message

Syntax

bool openssl_pkcs7_sign ( string infilename, string outfilename, mixed signcert, mixed privkey, array headers [, int flags [, string extracerts]] )

openssl_pkcs7_sign() takes the contents of the file named infilename and signs them using the certificate and its matching private key specified by signcert and privkey parameters.

headers is an array of headers that will be prepended to the data after it has been signed (see openssl_pkcs7_encrypt() for more information about the format of this parameter.

flags can be used to alter the output - see PKCS7 constants - if not specified, it defaults to PKCS7_DETACHED.

extracerts specifies the name of a file containing a bunch of extra certificates to include in the signature which can for example be used to help the recipient to verify the certificate that you used.

Example 1. openssl_pkcs7_sign() example

<?php
// the message you want to sign so that recipient can be sure it was you that
// sent it
$data = <<<EOD

You have my authorization to spend
$10,000 on dinner expenses.

The CEO
EOD;
// save message to file
$fp = fopen("msg.txt", "w");
fwrite($fp, $data);
fclose($fp);
// encrypt it
if (openssl_pkcs7_sign("msg.txt", "signed.txt", "mycert.pem",
    array(
"file://mycert.pem", "mypassphrase"),
    array(
"To" => "joes@example.com", // keyed syntax
          
"From: HQ <ceo@example.com>", // indexed syntax
          
"Subject" => "Eyes only")
    )) {
    
// message signed - send it!
    
exec(ini_get("sendmail_path") . " < signed.txt");
}
?>

Php openssl pkcs7 sign Function syntax tag

openssl pkcs7 sign 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 sign 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.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online