@@ -14,14 +14,22 @@ $cipher = 'AES-128-CBC';
1414$ pub_key = "file:// " . __DIR__ . "/public.key " ;
1515$ priv_key = "file:// " . __DIR__ . "/private_rsa_1024.key " ;
1616
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+
1928openssl_seal ($ data , $ sealed , $ ekeys , array ($ pub_key , $ pub_key ), $ cipher , $ iv );
2029openssl_open ($ sealed , $ decrypted , $ ekeys [0 ], $ priv_key , $ cipher , $ iv );
2130echo $ decrypted ;
2231?>
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
2735openssl_seal() test
0 commit comments