php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80236 How $tag works in openssl_encrypt() with GCM mode is unclear
Submitted: 2020-10-14 16:24 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: adrian at proresult dot no Assigned:
Status: Open Package: OpenSSL related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
 [2020-10-14 16:24 UTC] adrian at proresult dot no
Description:
------------
---
From manual page: https://php.net/function.openssl-encrypt
---
As the documentation stands today, I think it's unclear how $tag is set and how you're supposed to retrieve/use it. After searching through other online sources for a while, I figured out that $tag is automatically set when calling openssl_encrypt(). Once I know, it seems obvious (since it's passed by reference, the function can alter its value), but before I was spoon-fed this information elsewhere, I had a hard time understanding how $tag should be formed, how it is set, and how it can be retrieved by the programmer. I suggest making this clearer in the documentation to avoid future confusion for other developers new to the openssl_* functions.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-15 03:24 UTC] a at b dot c dot de
I agree that it could be clearer that those two variables are for values returned by the function. There is an example of their use further down, but as it is only a snippet one could easily think that maybe those variables were being set in earlier code not shown.

I've made a submission through the online editor edit.php.net that I think gives the right idea. I didn't go to too much detail about what the tag is or what it's for or how it's to be used because - this being crypto and therefore Not A Toy™ - specialised references would be a more appropriate source for the necessary background.
 [2023-04-13 09:48 UTC] viekkumar249 at gmail dot com
Automobile Rider are sharing latest news about auto, electric vehicle and bike, scooter, cars etc. More info to visit:(https://automobilerider.com)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC