diff options
author | Alex Klyubin <klyubin@google.com> | 2015-03-27 16:53:44 -0700 |
---|---|---|
committer | Alex Klyubin <klyubin@google.com> | 2015-03-30 12:53:23 -0700 |
commit | 4ab8ea4498aa25eafdbaadd238fed6eab3f6ee59 (patch) | |
tree | 57c29e100d399530f239961857c47598bb471b19 /keystore/java/android/security/KeyStoreKeyConstraints.java | |
parent | 36ee836d2f6e6df59d6a20a69421639bacf25559 (diff) |
Add HmacSHA256 backed by AndroidKeyStore.
This also adds the MAC length constraint on imported HMAC keys. HMAC
doesn't work without this constraint at the moment.
Bug: 18088752
Change-Id: I8613f58f5d2a84df00bcf6179d13e30619440330
Diffstat (limited to 'keystore/java/android/security/KeyStoreKeyConstraints.java')
-rw-r--r-- | keystore/java/android/security/KeyStoreKeyConstraints.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/keystore/java/android/security/KeyStoreKeyConstraints.java b/keystore/java/android/security/KeyStoreKeyConstraints.java index 47bb1ccbbeb7..b5e2436dc0cf 100644 --- a/keystore/java/android/security/KeyStoreKeyConstraints.java +++ b/keystore/java/android/security/KeyStoreKeyConstraints.java @@ -401,6 +401,20 @@ public abstract class KeyStoreKeyConstraints { throw new IllegalArgumentException("Unknown digest: " + digest); } } + + /** + * @hide + */ + public static Integer getOutputSizeBytes(@DigestEnum int digest) { + switch (digest) { + case NONE: + return null; + case SHA256: + return 256 / 8; + default: + throw new IllegalArgumentException("Unknown digest: " + digest); + } + } } @Retention(RetentionPolicy.SOURCE) |