[ 
https://issues.apache.org/jira/browse/CAMEL-21423?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-21423.
---------------------------------
    Resolution: Fixed

> camel-crypto - It is not possible to use "inline" with "AES/GCM/NoPadding"
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-21423
>                 URL: https://issues.apache.org/jira/browse/CAMEL-21423
>             Project: Camel
>          Issue Type: Bug
>          Components:  camel-crypto
>    Affects Versions: 4.4.4, 4.8.1
>            Reporter: Zheng Feng
>            Assignee: Zheng Feng
>            Priority: Minor
>             Fix For: 4.4.5, 4.8.2, 4.9.0
>
>
> {code:java}
>          CryptoDataFormat cryptoFormat = new 
> CryptoDataFormat("AES/GCM/NoPadding", secretKey);
>          cryptoFormat.setInitializationVector(iv); // it should set the iv 
> based on the info from paramSpec.. 
>          cryptoFormat.setShouldInlineInitializationVector(true);
>          cryptoFormat.setAlgorithmParameterSpec(paramSpec);
> {code}
> Will not work, but with "AES/GCM/NoPadding", it expects to configure a 
> GCMParamSpec.
> The related codes are inĀ 
> [CryptoDataFormat.java|https://github.com/apache/camel/blob/295c7871cf351340021795d6d38258e0c3e92ca9/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/CryptoDataFormat.java#L112-L120]
> {code:java}
>       if (mode == ENCRYPT_MODE || mode == DECRYPT_MODE) {
>             if (iv != null) {
>                 cipher.init(mode, key, new IvParameterSpec(iv));
>             } else if (parameterSpec != null) {
>                 cipher.init(mode, key, parameterSpec);
>             } else {
>                 cipher.init(mode, key);
>             }
>         }
> {code}
> I think it could check *(parameterSpec != null)* at first.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to