summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2011-02-23 18:45:29 -0800
committerJesse Wilson <jessewilson@google.com>2011-02-24 08:42:52 -0800
commit8bc378b1cec65bc06766a14a9cc575fec931b418 (patch)
treedf8f98ce0ffadc67857b0e27093265392a30c780 /support
parent9ebb5807fa40f3bddf3567906a2c77ee053174bb (diff)
downloadlibcore-8bc378b1cec65bc06766a14a9cc575fec931b418.zip
libcore-8bc378b1cec65bc06766a14a9cc575fec931b418.tar.gz
libcore-8bc378b1cec65bc06766a14a9cc575fec931b418.tar.bz2
Don't generate large DH keys when small ones will do.
This dramatically improves the runtime of these tests from a few minutes to a few seconds. Also update known failures to cover the new reasons why these tests are failing. Change-Id: I82b738f3f1fb24a08d334fa960153692a0c9144f http://b/3474446
Diffstat (limited to 'support')
-rw-r--r--support/src/test/java/libcore/java/security/StandardNames.java43
1 files changed, 42 insertions, 1 deletions
diff --git a/support/src/test/java/libcore/java/security/StandardNames.java b/support/src/test/java/libcore/java/security/StandardNames.java
index 58aaf28..9f32309 100644
--- a/support/src/test/java/libcore/java/security/StandardNames.java
+++ b/support/src/test/java/libcore/java/security/StandardNames.java
@@ -17,8 +17,14 @@
package libcore.java.security;
import java.security.Security;
+import java.security.spec.DSAPrivateKeySpec;
+import java.security.spec.DSAPublicKeySpec;
+import java.security.spec.ECPrivateKeySpec;
+import java.security.spec.ECPublicKeySpec;
+import java.security.spec.KeySpec;
+import java.security.spec.RSAPrivateCrtKeySpec;
+import java.security.spec.RSAPublicKeySpec;
import java.util.Arrays;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -27,6 +33,8 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.crypto.spec.DHPrivateKeySpec;
+import javax.crypto.spec.DHPublicKeySpec;
import junit.framework.Assert;
/**
@@ -663,6 +671,39 @@ public final class StandardNames extends Assert {
}
}
}
+
+ public static final Map<String, Class<? extends KeySpec>> PRIVATE_KEY_SPEC_CLASSES;
+ public static final Map<String, Class<? extends KeySpec>> PUBLIC_KEY_SPEC_CLASSES;
+ public static final Map<String, Integer> MINIMUM_KEY_SIZE;
+ static {
+ PRIVATE_KEY_SPEC_CLASSES = new HashMap<String, Class<? extends KeySpec>>();
+ PUBLIC_KEY_SPEC_CLASSES = new HashMap<String, Class<? extends KeySpec>>();
+ MINIMUM_KEY_SIZE = new HashMap<String, Integer>();
+ PRIVATE_KEY_SPEC_CLASSES.put("RSA", RSAPrivateCrtKeySpec.class);
+ PUBLIC_KEY_SPEC_CLASSES.put("RSA", RSAPublicKeySpec.class);
+ MINIMUM_KEY_SIZE.put("RSA", 256);
+ PRIVATE_KEY_SPEC_CLASSES.put("DSA", DSAPrivateKeySpec.class);
+ PUBLIC_KEY_SPEC_CLASSES.put("DSA", DSAPublicKeySpec.class);
+ MINIMUM_KEY_SIZE.put("DSA", 512);
+ PRIVATE_KEY_SPEC_CLASSES.put("DH", DHPrivateKeySpec.class);
+ PUBLIC_KEY_SPEC_CLASSES.put("DH", DHPublicKeySpec.class);
+ MINIMUM_KEY_SIZE.put("DH", 256);
+ PRIVATE_KEY_SPEC_CLASSES.put("EC", ECPrivateKeySpec.class);
+ PUBLIC_KEY_SPEC_CLASSES.put("EC", ECPublicKeySpec.class);
+ MINIMUM_KEY_SIZE.put("EC", 256);
+ }
+
+ public static Class<? extends KeySpec> getPrivateKeySpecClass(String algName) {
+ return PRIVATE_KEY_SPEC_CLASSES.get(algName);
+ }
+
+ public static Class<? extends KeySpec> getPublicKeySpecClass(String algName) {
+ return PUBLIC_KEY_SPEC_CLASSES.get(algName);
+ }
+
+ public static int getMinimumKeySize(String algName) {
+ return MINIMUM_KEY_SIZE.get(algName);
+ }
/**
* Asserts that the cipher suites array is non-null and that it