Repository navigation
Conversation
…w the CBC mode with a random initialization vector With the algorithm name alone, such as AES, Java encrypts in ECB mode, and a full transformation fails because the same value names the key. A new optional mode option uses <algorithm>/<mode>/PKCS5Padding with a new random initialization vector put in front of each message. Without mode nothing changes, so earlier data still decrypts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
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.
Fixes #3246.
With
algorithm: AESthe crypto actions encrypt in ECB mode (the Java default for the name alone), and a full transformation such asAES/CBC/PKCS5Paddingfails because the same value also names the secret key. So the same text always gave the same bytes, and there was no way to pick another mode.Changes
modeoption oncrypto-encrypt-actionandcrypto-decrypt-action. Withmode: CBCthe transformation is<algorithm>/CBC/PKCS5Padding, and the crypto data format puts a new random initialization vector in front of each message (inline: true), which the decrypt action reads back.modethe actions work as before, so data encrypted by earlier versions still decrypts. The descriptions say thatAESalone is ECB and recommendmode: CBC, set on both actions at the same time.IvParameterSpec, which GCM does not take.Tests
CryptoKameletsTest: withmode=CBC(AES and DESede) two encryptions of the same text differ and both decrypt; withoutmodethe output is the same as before (ECB) and decrypts../mvnw clean installpasses.Claude Code on behalf of Claus Ibsen
🤖 Generated with Claude Code