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.