Merge "Reject HMAC keys smaller than 64 bits."
This commit is contained in:
committed by
Android (Google) Code Review
commit
2c92e9daa4
@@ -200,6 +200,11 @@ public abstract class AndroidKeyStoreKeyGeneratorSpi extends KeyGeneratorSpi {
|
||||
}
|
||||
|
||||
if (mKeymasterAlgorithm == KeymasterDefs.KM_ALGORITHM_HMAC) {
|
||||
if (mKeySizeBits < 64) {
|
||||
throw new InvalidAlgorithmParameterException(
|
||||
"HMAC key size must be at least 64 bits.");
|
||||
}
|
||||
|
||||
// JCA HMAC key algorithm implies a digest (e.g., HmacSHA256 key algorithm
|
||||
// implies SHA-256 digest). Because keymaster HMAC key is authorized only for
|
||||
// one digest, we don't let algorithm parameter spec override the digest implied
|
||||
|
||||
Reference in New Issue
Block a user