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: -
From: adrian at proresult dot no Assigned:
Status: Open Package: OpenSSL related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
36 - 7 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Mar 28 09:01:26 2024 UTC