diff options
author | Alex Klyubin <klyubin@google.com> | 2015-06-09 10:03:00 -0700 |
---|---|---|
committer | Alex Klyubin <klyubin@google.com> | 2015-06-09 10:03:00 -0700 |
commit | bc46932a11afaae3bedc1454fa5b5bb795bff514 (patch) | |
tree | a3c3c354f042acc30edfa88a4a11cbb79fd6b2e0 /luni | |
parent | 2ae508725e0b6c4dd4c23717bc1625bd745670b6 (diff) | |
download | libcore-bc46932a11afaae3bedc1454fa5b5bb795bff514.zip libcore-bc46932a11afaae3bedc1454fa5b5bb795bff514.tar.gz libcore-bc46932a11afaae3bedc1454fa5b5bb795bff514.tar.bz2 |
Skip AndroidKeyStore provider in ECDHKeyAgreementTest.
AndroidKeyStore Provider requires special keys which cannot be created
through standard JCA API. The Provider does not expose ECDH at the
moment either. If/when it does expose ECDH, it will be tested in
cts/tests/tests/keystore rather than here.
Bug: 21723152
Change-Id: I73128907783b4f08c60c9af128e12a124a286054
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/test/java/libcore/javax/crypto/ECDHKeyAgreementTest.java | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/luni/src/test/java/libcore/javax/crypto/ECDHKeyAgreementTest.java b/luni/src/test/java/libcore/javax/crypto/ECDHKeyAgreementTest.java index cabe5c9..cc29640 100644 --- a/luni/src/test/java/libcore/javax/crypto/ECDHKeyAgreementTest.java +++ b/luni/src/test/java/libcore/javax/crypto/ECDHKeyAgreementTest.java @@ -38,7 +38,9 @@ import java.security.spec.ECGenParameterSpec; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Arrays; +import java.util.ArrayList; import java.util.Comparator; +import java.util.List; import javax.crypto.KeyAgreement; import javax.crypto.SecretKey; @@ -374,8 +376,8 @@ public class ECDHKeyAgreementTest extends TestCase { if (providers == null) { return new Provider[0]; } - // Sort providers by name to guarantee non-determinism in the order in which providers are - // used in the tests. + // Sort providers by name to guarantee deterministic order in which providers are used in + // the tests. return sortByName(providers); } @@ -384,8 +386,21 @@ public class ECDHKeyAgreementTest extends TestCase { if (providers == null) { return new Provider[0]; } - // Sort providers by name to guarantee non-determinism in the order in which providers are - // used in the tests. + + // Do not test AndroidKeyStore's KeyFactory. It only handles Android Keystore-backed keys. + // It's OKish not to test AndroidKeyStore's KeyFactory here because it's tested by + // cts/tests/test/keystore. + List<Provider> filteredProvidersList = new ArrayList<Provider>(providers.length); + for (Provider provider : providers) { + if ("AndroidKeyStore".equals(provider.getName())) { + continue; + } + filteredProvidersList.add(provider); + } + providers = filteredProvidersList.toArray(new Provider[filteredProvidersList.size()]); + + // Sort providers by name to guarantee deterministic order in which providers are used in + // the tests. return sortByName(providers); } |