diff options
author | Kenny Root <kroot@google.com> | 2014-05-08 08:55:34 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-08 08:55:34 +0000 |
commit | 0d6d32920134aa84e55fab59b6bd3a71c7bcb38f (patch) | |
tree | a946968305f48216618f8e0c7332f64ee0709465 /support | |
parent | 578741db192290a996a4a4f1fe6d7c28b64181c3 (diff) | |
parent | 6005b896b58659f8c2e0693bd9ead32706a05044 (diff) | |
download | libcore-0d6d32920134aa84e55fab59b6bd3a71c7bcb38f.zip libcore-0d6d32920134aa84e55fab59b6bd3a71c7bcb38f.tar.gz libcore-0d6d32920134aa84e55fab59b6bd3a71c7bcb38f.tar.bz2 |
am 6005b896: am 4abcf7ad: Merge changes Iaaafcbed,Ifbca5637
* commit '6005b896b58659f8c2e0693bd9ead32706a05044':
KeyStoreTest: add more key types
KeyManagerFactoryTest: add all the possible key types
Diffstat (limited to 'support')
-rw-r--r-- | support/src/test/java/libcore/java/security/TestKeyStore.java | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/support/src/test/java/libcore/java/security/TestKeyStore.java b/support/src/test/java/libcore/java/security/TestKeyStore.java index 86d6f4c..203c028 100644 --- a/support/src/test/java/libcore/java/security/TestKeyStore.java +++ b/support/src/test/java/libcore/java/security/TestKeyStore.java @@ -54,6 +54,7 @@ import java.security.cert.X509Certificate; import java.security.interfaces.ECPrivateKey; import java.security.spec.PKCS8EncodedKeySpec; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.List; @@ -371,10 +372,15 @@ public final class TestKeyStore extends Assert { for (String keyAlgorithm : keyAlgorithms) { String publicAlias = aliasPrefix + "-public-" + keyAlgorithm; String privateAlias = aliasPrefix + "-private-" + keyAlgorithm; - if (keyAlgorithm.equals("EC_RSA") && signer == null && rootCa == null) { + if ((keyAlgorithm.equals("EC_RSA") || keyAlgorithm.equals("DH_RSA")) + && signer == null && rootCa == null) { createKeys(keyStore, keyAlgorithm, publicAlias, privateAlias, privateKey(keyStore, keyPassword, "RSA", "RSA")); continue; + } else if (keyAlgorithm.equals("DH_DSA") && signer == null && rootCa == null) { + createKeys(keyStore, keyAlgorithm, publicAlias, privateAlias, + privateKey(keyStore, keyPassword, "DSA", "DSA")); + continue; } createKeys(keyStore, keyAlgorithm, publicAlias, privateAlias, signer); } @@ -436,8 +442,14 @@ public final class TestKeyStore extends Assert { if (keyAlgorithm.equals("RSA")) { // 512 breaks SSL_RSA_EXPORT_* on RI and TLS_ECDHE_RSA_WITH_RC4_128_SHA for us keySize = 1024; + } else if (keyAlgorithm.equals("DH_RSA")) { + keySize = 512; + keyAlgorithm = "DH"; } else if (keyAlgorithm.equals("DSA")) { keySize = 512; + } else if (keyAlgorithm.equals("DH_DSA")) { + keySize = 512; + keyAlgorithm = "DH"; } else if (keyAlgorithm.equals("EC")) { keySize = 256; } else if (keyAlgorithm.equals("EC_RSA")) { @@ -686,7 +698,7 @@ public final class TestKeyStore extends Assert { continue; } if (found != null) { - throw new IllegalStateException("KeyStore has more than one private key for " + throw new IllegalStateException("KeyStore has more than one private key for" + " keyAlgorithm: " + keyAlgorithm + " signatureAlgorithm: " + signatureAlgorithm + "\nfirst: " + found.getPrivateKey() @@ -695,13 +707,14 @@ public final class TestKeyStore extends Assert { found = privateKey; } if (found == null) { - throw new IllegalStateException("KeyStore contained no private key for " + throw new IllegalStateException("KeyStore contained no private key for" + " keyAlgorithm: " + keyAlgorithm + " signatureAlgorithm: " + signatureAlgorithm); } return found; } catch (Exception e) { - throw new RuntimeException(e); + throw new RuntimeException("Problem getting key for " + keyAlgorithm + + " and signature " + signatureAlgorithm, e); } } |