Merge "Updating accepted HMAC key sizes" am: 1cf90f78f1 am: 7f813b80d3

am: 432cb5d523

Change-Id: I1308b205762df42ed5fdc23da00f84a8cc31d45e
This commit is contained in:
Max Bires
2019-11-19 19:57:30 -08:00
committed by android-build-merger

View File

@@ -210,13 +210,9 @@ public abstract class AndroidKeyStoreKeyGeneratorSpi extends KeyGeneratorSpi {
}
}
if (mKeymasterAlgorithm == KeymasterDefs.KM_ALGORITHM_HMAC) {
if (mKeySizeBits < 64) {
if (mKeySizeBits < 64 || mKeySizeBits > 512) {
throw new InvalidAlgorithmParameterException(
"HMAC key size must be at least 64 bits.");
}
if (mKeySizeBits > 512 && spec.isStrongBoxBacked()) {
throw new InvalidAlgorithmParameterException(
"StrongBox HMAC key size must be smaller than 512 bits.");
"HMAC key sizes must be within 64-512 bits, inclusive.");
}
// JCA HMAC key algorithm implies a digest (e.g., HmacSHA256 key algorithm