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