openssl_pkcs7_signSign an S/MIME message
&reftitle.description;
boolopenssl_pkcs7_signstringinfilenamestringoutfilenamemixedsigncertmixedprivkeyarrayheadersintflagsstringextracertsopenssl_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.
&reftitle.parameters;
infilenameoutfilenamesigncertprivkeyheadersheaders 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.
flagsflags can be used to alter the output - see PKCS7 constants - if not specified,
it defaults to PKCS7_DETACHED.
extracertsextracerts 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.
&reftitle.returnvalues;
&return.success;
&reftitle.examples;
openssl_pkcs7_sign example
"joes@example.com", // keyed syntax
"From: HQ ", // indexed syntax
"Subject" => "Eyes only")
)) {
// message signed - send it!
exec(ini_get("sendmail_path") . " < signed.txt");
}
?>
]]>