aboutsummaryrefslogtreecommitdiff
path: root/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java')
-rw-r--r--keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java b/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java
index ea5d91b..001ab89 100644
--- a/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java
+++ b/keystore-cts/java/android/keystore/cts/util/KeyStoreUtil.java
@@ -13,6 +13,7 @@
*/
package android.keystore.cts.util;
+import static org.junit.Assume.assumeTrue;
import android.content.Context;
import android.security.keystore.KeyProtection;
import android.keystore.cts.util.TestUtils;
@@ -53,6 +54,8 @@ public class KeyStoreUtil {
public static final int KM_VERSION_KEYMASTER_4 = 40;
public static final int KM_VERSION_KEYMASTER_4_1 = 41;
public static final int KM_VERSION_KEYMINT_1 = 100;
+ public static final int KM_VERSION_KEYMINT_2 = 200;
+ public static final int KM_VERSION_KEYMINT_3 = 300;
private static final List kmSupportedDigests = List.of("md5","sha-1","sha-224","sha-384",
"sha-256","sha-512");
@@ -91,7 +94,11 @@ public class KeyStoreUtil {
}
}
- public static int getFeatureVersionKeystore() {
+ public static int getFeatureVersionKeystore(boolean isStrongBox) {
+ if (isStrongBox) {
+ return TestUtils.getFeatureVersionKeystoreStrongBox(
+ ApplicationProvider.getApplicationContext());
+ }
return TestUtils.getFeatureVersionKeystore(ApplicationProvider.getApplicationContext());
}
@@ -173,4 +180,9 @@ public class KeyStoreUtil {
new ByteArrayInputStream(x509holder.getEncoded()));
return x509c;
}
+
+ public static void assumeKeyMintV1OrNewer(boolean isStrongBox) {
+ assumeTrue("Test can only run on KeyMint v1 and above",
+ KeyStoreUtil.getFeatureVersionKeystore(isStrongBox) >= KM_VERSION_KEYMINT_1);
+ }
}