55--FILE--
66<?php
77$ infile = __DIR__ . "/plain.txt " ;
8- $ outfile = tempnam (sys_get_temp_dir (), "cms_enc_basic " );
9- if ($ outfile === false )
10- die ("failed to get a temporary filename! " );
11- $ outfile2 = $ outfile . ".out " ;
12- $ outfile3 = tempnam (sys_get_temp_dir (), "cms_enc_basic " );
13- if ($ outfile3 === false )
14- die ("failed to get a temporary filename! " );
8+ $ outfile = __DIR__ . "/openssl_cms_encrypt_basic.out1 " ;
9+ $ outfile2 = __DIR__ . "/openssl_cms_encrypt_basic.out2 " ;
10+ $ outfile3 = __DIR__ . "/openssl_cms_encrypt_basic.out3 " ;
1511$ single_cert = "file:// " . __DIR__ . "/cert.crt " ;
1612$ privkey = "file:// " . __DIR__ . "/private_rsa_1024.key " ;
1713$ wrongkey = "file:// " . __DIR__ . "/private_rsa_2048.key " ;
@@ -27,7 +23,7 @@ var_dump(openssl_cms_encrypt($infile, $outfile, $single_cert, $headers, cipher_a
2723var_dump (openssl_cms_encrypt ($ infile , $ outfile , openssl_x509_read ($ single_cert ), $ headers , cipher_algo: $ cipher ));
2824var_dump (openssl_cms_decrypt ($ outfile , $ outfile2 , $ single_cert , $ privkey ));
2925readfile ($ outfile2 );
30- var_dump (openssl_cms_encrypt ($ infile , $ outfile , $ single_cert , $ assoc_headers , cipher_algo: $ cipher ));
26+ var_dump (openssl_cms_encrypt ($ infile , $ outfile , $ single_cert , $ assoc_headers , cipher_algo: " AES-128-CBC " ));
3127var_dump (openssl_cms_encrypt ($ infile , $ outfile , $ single_cert , $ empty_headers , cipher_algo: $ cipher ));
3228var_dump (openssl_cms_encrypt ($ wrong , $ outfile , $ single_cert , $ headers , cipher_algo: $ cipher ));
3329var_dump (openssl_cms_encrypt ($ empty , $ outfile , $ single_cert , $ headers , cipher_algo: $ cipher ));
@@ -40,11 +36,9 @@ var_dump(openssl_cms_encrypt($infile, $outfile3, $single_cert, $headers, flags:
4036
4137if (file_exists ($ outfile )) {
4238 echo "true \n" ;
43- unlink ($ outfile );
4439}
4540if (file_exists ($ outfile2 )) {
4641 echo "true \n" ;
47- unlink ($ outfile2 );
4842}
4943
5044if (file_exists ($ outfile3 )) {
@@ -53,9 +47,14 @@ if (file_exists($outfile3)) {
5347 echo "true \n" ;
5448 }
5549 unset($ content );
56- unlink ($ outfile3 );
5750}
5851?>
52+ --CLEAN--
53+ <?php
54+ @unlink (__DIR__ . "/openssl_cms_encrypt_basic.out1 " );
55+ @unlink (__DIR__ . "/openssl_cms_encrypt_basic.out2 " );
56+ @unlink (__DIR__ . "/openssl_cms_encrypt_basic.out3 " );
57+ ?>
5958--EXPECT--
6059bool(true)
6160bool(true)
0 commit comments