forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix request #70438: Add IV parameter for openssl_seal and openssl_open
- Loading branch information
Showing
4 changed files
with
79 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Request #70438: Add IV parameter for openssl_seal and openssl_open | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded("openssl")) { | ||
print "skip"; | ||
} | ||
if (!in_array('AES-128-CBC', openssl_get_cipher_methods(true))) { | ||
print "skip"; | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
$data = "openssl_seal() test"; | ||
$cipher = 'AES-128-CBC'; | ||
$pub_key = "file://" . dirname(__FILE__) . "/public.key"; | ||
$priv_key = "file://" . dirname(__FILE__) . "/private.key"; | ||
|
||
openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), $cipher); | ||
openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), 'sparkles', $iv); | ||
openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), $cipher, $iv); | ||
openssl_open($sealed, $decrypted, $ekeys[0], $priv_key, $cipher, $iv); | ||
echo $decrypted; | ||
?> | ||
--EXPECTF-- | ||
Warning: openssl_seal(): Cipher algorithm requires an IV to be supplied as a sixth parameter in %s on line %d | ||
|
||
Warning: openssl_seal(): Unknown signature algorithm. in %s on line %d | ||
openssl_seal() test |