私は完全には理解していません。いくつかのドキュメントやヘルプをいただければ幸いです:)
PHP を使用して、ezcomponents のメール オブジェクトを使用して MIME を作成します。しかし、私が理解していないのは次のとおりです。
openssl_pkcs7_signで署名して、元の MIME から S/MIME メッセージを作成しますか? それとも、S/MIME をゼロから作成し、完成したら署名しますか?
物事の正しいやり方を理解しようと努めているので、ご容赦ください。
編集:私の質問をよりよく説明するために、このコードを見つけました
<?
// Setup mail headers.
$headers = array("To" => "someone@nowhere.net",
"From" => "noone@somewhere.net",
"Subject" => "A signed and encrypted message.");
// Sign the message first
openssl_pkcs7_sign("msg.txt","signed.txt",
"signing_cert.pem",array("private_key.pem",
"password"),array());
// Get the public key certificate.
$pubkey = file_get_contents("cert.pem");
//encrypt the message, now put in the headers.
openssl_pkcs7_encrypt("signed.txt", "enc.txt",
$pubkey,$headers,0,1);
$data = file_get_contents("enc.txt");
// separate header and body, to use with mail function
// unfortunate but required, else we have two sets of headers
// and the email client doesn't decode the attachment
$parts = explode("\n\n", $data, 2);
// send mail (headers in the Headers parameter will override those
// generated for the To & Subject parameters)
mail($mail, $subject, $parts[1], $parts[0]);
?>