From d23a1f706f0c24fade1a1c2f604009a7c9e70002 Mon Sep 17 00:00:00 2001 From: Alex Klyubin Date: Fri, 27 Mar 2015 14:39:28 -0700 Subject: Symmetric key generation for AndroidKeyStore. This currently supports AES and HMAC with SHA-256. Bug: 18088752 Change-Id: Ife55438cf4129b895295681bb35091cd37eb73fb --- .../android/security/KeyStoreKeyConstraints.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'keystore/java/android/security/KeyStoreKeyConstraints.java') diff --git a/keystore/java/android/security/KeyStoreKeyConstraints.java b/keystore/java/android/security/KeyStoreKeyConstraints.java index 01e6dcd..47bb1cc 100644 --- a/keystore/java/android/security/KeyStoreKeyConstraints.java +++ b/keystore/java/android/security/KeyStoreKeyConstraints.java @@ -290,6 +290,22 @@ public abstract class KeyStoreKeyConstraints { throw new IllegalArgumentException("Unknown padding: " + padding); } } + + /** + * @hide + */ + public static String toString(@PaddingEnum int padding) { + switch (padding) { + case NONE: + return "NONE"; + case ZERO: + return "ZERO"; + case PKCS7: + return "PKCS#7"; + default: + throw new IllegalArgumentException("Unknown padding: " + padding); + } + } } @Retention(RetentionPolicy.SOURCE) @@ -425,5 +441,17 @@ public abstract class KeyStoreKeyConstraints { throw new IllegalArgumentException("Unknown block mode: " + mode); } } + + /** + * @hide + */ + public static String toString(@BlockModeEnum int mode) { + switch (mode) { + case ECB: + return "ECB"; + default: + throw new IllegalArgumentException("Unknown block mode: " + mode); + } + } } } -- cgit v1.1