1--TEST-- 2openssl_cms_sign() der tests 3--EXTENSIONS-- 4openssl 5--FILE-- 6<?php 7$infile = __DIR__ . "/cert.crt"; 8$outfile = tempnam(sys_get_temp_dir(), "ssl"); 9if ($outfile === false) { 10 die("failed to get a temporary filename!"); 11} 12 13$privkey = "file://" . __DIR__ . "/private_rsa_1024.key"; 14$single_cert = "file://" . __DIR__ . "/cert.crt"; 15$assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_cms_sign()"); 16$headers = array("test@test", "testing openssl_cms_sign()"); 17$empty_headers = array(); 18$wrong = "wrong"; 19$empty = ""; 20 21var_dump(openssl_cms_sign($infile, $outfile, openssl_x509_read($single_cert), $privkey, $empty_headers, OPENSSL_CMS_DETACHED|OPENSSL_CMS_BINARY, OPENSSL_ENCODING_DER)); 22var_dump(openssl_cms_sign($infile, $outfile, openssl_x509_read($single_cert), $privkey, $headers)); 23 24if (file_exists($outfile)) { 25 echo "true\n"; 26 unlink($outfile); 27} 28?> 29--EXPECT-- 30bool(true) 31bool(true) 32true 33