I do not quite understand, and some documents or help will be greatly appreciated :)
Using PHP, I create MIME using ezcomponents Mail. But I do not understand:
Do you create an S / MIME message from the original MIME by signing it with openssl_pkcs7_sign ? or do you create S / MIME from scratch and sign it when it's done?
Please carry me when I try to figure out the right way to do things.
EDIT : found this piece of code to better understand my question
<?
$headers = array("To" => "someone@nowhere.net",
"From" => "noone@somewhere.net",
"Subject" => "A signed and encrypted message.");
openssl_pkcs7_sign("msg.txt","signed.txt",
"signing_cert.pem",array("private_key.pem",
"password"),array());
$pubkey = file_get_contents("cert.pem");
openssl_pkcs7_encrypt("signed.txt", "enc.txt",
$pubkey,$headers,0,1);
$data = file_get_contents("enc.txt");
$parts = explode("\n\n", $data, 2);
mail($mail, $subject, $parts[1], $parts[0]);
?>
source
share