xref: /PHP-7.3/ext/openssl/tests/bug70438.phpt (revision 3c42f64e)
1--TEST--
2Request #70438: Add IV parameter for openssl_seal and openssl_open
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) print "skip";
6if (!in_array('AES-128-CBC', openssl_get_cipher_methods(true))) {
7    print "skip";
8}
9?>
10--FILE--
11<?php
12$data = "openssl_seal() test";
13$cipher = 'AES-128-CBC';
14$pub_key = "file://" . dirname(__FILE__) . "/public.key";
15$priv_key = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
16
17openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), $cipher);
18openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), 'sparkles', $iv);
19openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), $cipher, $iv);
20openssl_open($sealed, $decrypted, $ekeys[0], $priv_key, $cipher, $iv);
21echo $decrypted;
22?>
23--EXPECTF--
24Warning: openssl_seal(): Cipher algorithm requires an IV to be supplied as a sixth parameter in %s on line %d
25
26Warning: openssl_seal(): Unknown signature algorithm. in %s on line %d
27openssl_seal() test
28