Add missing mapping between JCA and keystore HMAC names.

This is a follow-up to 70376a7728 where
I forgot to update this mapping.

Bug: 18088752
Change-Id: I322a9abd642ddee3bd2b4f49379b121012e32836
This commit is contained in:
Alex Klyubin
2015-04-09 09:28:38 -07:00
parent a482b0469c
commit 5324702a02
2 changed files with 11 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ public class AndroidKeyStoreProvider extends Provider {
putSecretKeyFactoryImpl("HmacSHA512");
// javax.crypto.Mac
putMacImpl("HmacSHA1", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA1");
putMacImpl("HmacSHA224", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA224");
putMacImpl("HmacSHA256", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA256");
putMacImpl("HmacSHA384", PACKAGE_NAME + ".KeyStoreHmacSpi$HmacSHA384");

View File

@@ -213,8 +213,18 @@ public abstract class KeyStoreKeyConstraints {
throw new IllegalArgumentException("HMAC digest not specified");
}
switch (digest) {
case Digest.MD5:
return "HmacMD5";
case Digest.SHA1:
return "HmacSHA1";
case Digest.SHA224:
return "HmacSHA224";
case Digest.SHA256:
return "HmacSHA256";
case Digest.SHA384:
return "HmacSHA384";
case Digest.SHA512:
return "HmacSHA512";
default:
throw new IllegalArgumentException(
"Unsupported HMAC digest: " + digest);