-
Bug
-
Resolution: Done
-
Undefined
-
None
-
None
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.