@@ -14,14 +14,22 @@ $cipher = 'AES-128-CBC';
14
14
$ pub_key = "file:// " . __DIR__ . "/public.key " ;
15
15
$ priv_key = "file:// " . __DIR__ . "/private_rsa_1024.key " ;
16
16
17
- openssl_seal ($ data , $ sealed , $ ekeys , array ($ pub_key , $ pub_key ), $ cipher );
18
- openssl_seal ($ data , $ sealed , $ ekeys , array ($ pub_key , $ pub_key ), 'sparkles ' , $ iv );
17
+ try {
18
+ openssl_seal ($ data , $ sealed , $ ekeys , array ($ pub_key , $ pub_key ), $ cipher );
19
+ } catch (\ValueError $ e ) {
20
+ echo $ e ->getMessage () . \PHP_EOL ;
21
+ }
22
+ try {
23
+ openssl_seal ($ data , $ sealed , $ ekeys , array ($ pub_key , $ pub_key ), 'sparkles ' , $ iv );
24
+ } catch (\ValueError $ e ) {
25
+ echo $ e ->getMessage () . \PHP_EOL ;
26
+ }
27
+
19
28
openssl_seal ($ data , $ sealed , $ ekeys , array ($ pub_key , $ pub_key ), $ cipher , $ iv );
20
29
openssl_open ($ sealed , $ decrypted , $ ekeys [0 ], $ priv_key , $ cipher , $ iv );
21
30
echo $ decrypted ;
22
31
?>
23
- --EXPECTF--
24
- Warning: openssl_seal(): Cipher algorithm requires an IV to be supplied as a sixth parameter in %s on line %d
25
-
26
- Warning: openssl_seal(): Unknown signature algorithm. in %s on line %d
32
+ --EXPECT--
33
+ openssl_seal(): Argument #6 ($iv) must provide an IV for chosen cipher algorithm
34
+ openssl_seal(): Argument #5 ($method) must be a valid signature algorithm
27
35
openssl_seal() test
0 commit comments