davsclaus opened a new issue, #3388:
URL: https://github.com/apache/camel-kamelets/issues/3388

   ## Description
   
   Most action Kamelets remove the component headers of the incoming message 
before their component step (#3240), and the PGP actions remove 
`CamelPGPDataFormat*`. `crypto-encrypt-action` and `crypto-decrypt-action` do 
not: a `CamelCrypto*` header that arrives on the incoming message (for example 
`CamelCryptoInitVector`) is read by the `crypto` data format before it falls 
back to its own settings, so it changes how the data format runs instead of the 
Kamelet's `algorithm`, `mode` and `key` options.
   
   ## Today
   
   - `kamelets/crypto-encrypt-action.kamelet.yaml` and 
`kamelets/crypto-decrypt-action.kamelet.yaml` pass all incoming headers, 
`CamelCrypto*` included, to the `marshal` / `unmarshal` step with the `crypto` 
data format (`CryptoDataFormat` in camel-crypto).
   
   ## After the change
   
   - Both templates start with `removeHeaders` with the pattern `CamelCrypto*`, 
before the `choice` on `mode`. The Kamelet options alone decide how the data is 
encrypted and decrypted; other headers are kept as before.
   - The "Good to know" part of both Kamelet descriptions says that 
`CamelCrypto*` headers of the incoming message are removed.
   - The `mode` option of both Kamelets accepts only `CBC` (`enum: ["CBC"]`), 
the mode its description documents. The template always uses `PKCS5Padding` and 
a new random initialization vector put in front of the data, which is the setup 
CBC needs; other modes were never checked with it.
   
   ## Code-level change and tests
   
   - `kamelets/crypto-encrypt-action.kamelet.yaml`, 
`kamelets/crypto-decrypt-action.kamelet.yaml`: first step `- removeHeaders: { 
pattern: "CamelCrypto*" }`, `enum: ["CBC"]` on `mode`, and the description 
update.
   - 
`library/camel-kamelets-catalog/src/test/resources/remove-headers/kamelets.csv`:
 rows for both Kamelets, so `KameletsRemoveHeadersTest` checks that the first 
step is the `removeHeaders`.
   - `CryptoKameletsTest`: a test that sends the same text twice with a 
`CamelCrypto*` header on the message and `mode: CBC`, and checks that the two 
results differ and both decrypt back to the text.
   - Regenerated files from `./mvnw clean install` (Kamelet doc pages, the 
copies under `library/camel-kamelets/src/main/resources/kamelets/`, 
`kamelets-index.json`).
   
   ## Additional Context
   
   The `mode` option is new on main (#3247) and not in a release yet, so no 
upgrade note is needed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to