-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use gcm for encryption #365
Conversation
$data = $iv . $cipherText; | ||
|
||
return $data; | ||
return $iv . $cipherText . $cipher->getTag(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪🏼
{ | ||
//Check if phpseclib v3 is used | ||
//needed for comaptibility with Magento 2.4 versions | ||
if (class_exists("phpseclib3\Crypt\AES")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, this selection between phpseclib3
and phpseclib
is not needed anymore? aka: assured to be there?
} | ||
|
||
$cipher = new AES('gcm'); | ||
$cipher->setKeyLength(256); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be extra clear, let's also add $cipher->setTagLength(128);
$cipher->setKey($secret); | ||
$cipher->setIV($iv); | ||
$iv = Random::string(12); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: from the functionality perspective, looks good. I'd use constants for nonce
and tag
lengths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Documentation:
Checklist: