Add legacy support for encryption and decryption methods in AES CyriptoService provider#30
Merged
Add legacy support for encryption and decryption methods in AES CyriptoService provider#30
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds a legacy flag to the AES CryptoService provider to support JavaScript–compatible payload formats.
- Extended
encryptanddecryptmethods with abool $legacyparameter to switch IV/TAG ordering. - Factored payload construction into
buildPayloadand parsing intoparsePayload. - Updated tests to verify both default and legacy encryption/decryption flows.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/AESCryptoServiceProvider.php | Added legacy parameter, buildPayload/parsePayload methods, and updated docblocks |
| tests/AESCryptoServiceProviderTest.php | Added legacy-encryption test cases and decrypt(..., legacy: true) assertion |
Comments suppressed due to low confidence (3)
src/AESCryptoServiceProvider.php:161
- [nitpick] The single-letter variable
$cis not descriptive. Rename it to$cipherTextfor clarity.
$c = base64_decode($encryptedData);
tests/AESCryptoServiceProviderTest.php:19
- [nitpick] Add spaces around the
=operator to match coding style ($encryptedText = ...).
$encryptedText= $csp->encrypt($plainText, legacy: true);
src/AESCryptoServiceProvider.php:152
- [nitpick] Merge the
$legacyparam description onto the same line (e.g.@param bool $legacy True = IV-TAG-EncryptedData; false = IV-EncryptedData-TAG).
@param bool $legacy
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #29
This pull request add better compatibilty with javascript encrypted data.