PHP.nl

openssl_cms_sign

openssl_cms_sign

Sign a file

bool **openssl_cms_sign** string $input_filename string $output_filename  $certificate  $private_key  $headers int $flags int $encoding  $untrusted_certificates_filename

This function signs a file with an X.509 certificate and key.

input_filenameThe name of the file to be signed.

output_filenameThe name of the file to deposit the results.

certificate The signing certificate. See for a list of valid values. Key/Certificate parameters

private_key The key associated with . See for a list of valid values. certificateKey/Certificate parameters

headersAn array of headers to be included in S/MIME output.

flags Flags to be passed to . cms_sign

encoding The encoding of the output file. One of , or . OPENSSL_ENCODING_SMIME``OPENSSL_ENCODING_DER``OPENSSL_ENCODING_PEM

untrusted_certificates_filenameIntermediate certificates to be included in the signature.

return.success

Voorbeeld: example

<?php

openssl_cms_sign('input.txt', 'output.txt', 'file://cert.pem', 'file://privkey.pem', null, OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER, 'chain.pem');
?>