Uploaded image for project: 'Red Hat build of Apache Camel'
  1. Red Hat build of Apache Camel
  2. RHBAC-72

camel-crypto - It is not possible to use "inline" with "AES/GCM/NoPadding"

XMLWordPrintable

               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);
      

      Will not work, but with "AES/GCM/NoPadding", it expects to configure a GCMParamSpec.

      The related codes are in??CryptoDataFormat.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);
                  }
              }
      

      I think it could check (parameterSpec != null) at first.

              fmariani@redhat.com Federico Mariani
              fuse-eng-automation fuse-eng-automation fuse-eng-automation
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: