Home > PHP > Function > OpenSSL > openssl_pkcs7_sign()

openssl_pkcs7_sign()

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)

Arguments

  • infilename
  • outfilename
  • signcert
  • privkey
  • headers - 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 - flags can be used to alter the output - see PKCS7 constants.
  • extracerts - 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.

Description

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.

Version

PHP 4.0.6, 5

Return value

Returns TRUE on success or FALSE on failure.