Bug #81502 [Com]: Problem with $tag argument of openssl_decrypt()
Edit report at https://bugs.php.net/bug.php?id=81502&edit=1
ID: 81502
Comment by: php-lover-4451 at gmail dot com
Reported by: alec at alec dot pl
Summary: Problem with $tag argument of openssl_decrypt()
Status: Open
Type: Bug
Package: OpenSSL related
PHP Version: 8.1.0RC3
Block user comment: N
Private report: N
New Comment:
https://creativecommons.org/choose/results-one?field_attribute_to_url=https%3A%2F%2Fa.tvfun.me%2Fvideo%2Flahn-al-hayat-modablaj-ep-25%2F
Previous Comments:
------------------------------------------------------------------------
[2021-10-04 17:12:50] alec at alec dot pl
Description:
------------
If I do:
$tag = null;
openssl_decrypt($cipher, $method, $ckey, $opts, $iv, $tag);
I get:
PHP Deprecated: openssl_decrypt(): Passing null to parameter #6 ($tag) of type string is
deprecated.
But if I do:
$tag = '';
openssl_decrypt($cipher, $method, $ckey, $opts, $iv, $tag);
I get:
PHP Warning: openssl_decrypt(): The tag cannot be used because the cipher algorithm does not
support AEAD.
I understand the warnings, but this is not convenient if my code is supposed to support AEAD and
non-AEAD cipher methods. Do I have to do two code paths depending on the cipher method is used?
What's more. The default value for the $tag argument in openssl_encrypt() is null, which sounds
kind of inconsistent.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81502&edit=1
Thread (9 messages)