summaryrefslogtreecommitdiff
path: root/keystore/java/android/security/KeyStoreKeyConstraints.java
diff options
context:
space:
mode:
authorAlex Klyubin <klyubin@google.com>2015-03-27 14:39:28 -0700
committerAlex Klyubin <klyubin@google.com>2015-03-27 15:57:53 -0700
commitd23a1f706f0c24fade1a1c2f604009a7c9e70002 (patch)
tree97a12bf99f2bf2c839554c609e5970bf30b1bd56 /keystore/java/android/security/KeyStoreKeyConstraints.java
parentdbd9a4b651aed25a50976ca0a68a979cc3f299fa (diff)
Symmetric key generation for AndroidKeyStore.
This currently supports AES and HMAC with SHA-256. Bug: 18088752 Change-Id: Ife55438cf4129b895295681bb35091cd37eb73fb
Diffstat (limited to 'keystore/java/android/security/KeyStoreKeyConstraints.java')
-rw-r--r--keystore/java/android/security/KeyStoreKeyConstraints.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/keystore/java/android/security/KeyStoreKeyConstraints.java b/keystore/java/android/security/KeyStoreKeyConstraints.java
index 01e6dcd2f705..47bb1ccbbeb7 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);
+ }
+ }
}
}