summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
Diffstat (limited to 'luni')
-rw-r--r--luni/src/test/java/libcore/java/security/cert/X509CertificateTest.java7
-rw-r--r--luni/src/test/java/tests/security/cert/CertificateTest.java15
2 files changed, 14 insertions, 8 deletions
diff --git a/luni/src/test/java/libcore/java/security/cert/X509CertificateTest.java b/luni/src/test/java/libcore/java/security/cert/X509CertificateTest.java
index c35f8e6..14c22ef 100644
--- a/luni/src/test/java/libcore/java/security/cert/X509CertificateTest.java
+++ b/luni/src/test/java/libcore/java/security/cert/X509CertificateTest.java
@@ -339,6 +339,13 @@ public class X509CertificateTest extends TestCase {
Provider[] providers = Security.getProviders("Signature." + c.getSigAlgName());
for (Provider p : providers) {
+ // Do not test AndroidKeyStore Provider. It does not accept vanilla public keys for
+ // signature verification. It's OKish not to test here because it's tested by
+ // cts/tests/tests/keystore.
+ if (p.getName().startsWith("AndroidKeyStore")) {
+ continue;
+ }
+
c.verify(signer, p.getName());
try {
diff --git a/luni/src/test/java/tests/security/cert/CertificateTest.java b/luni/src/test/java/tests/security/cert/CertificateTest.java
index d13e16b..194bfdb 100644
--- a/luni/src/test/java/tests/security/cert/CertificateTest.java
+++ b/luni/src/test/java/tests/security/cert/CertificateTest.java
@@ -300,17 +300,10 @@ public class MyModifiablePublicKey implements PublicKey {
private Certificate cert;
- private Provider wrongProvider;
-
- private Provider usefulProvider;
-
public void setUp() throws Exception {
super.setUp();
TestUtils.initCertPathSSCertChain();
cert = TestUtils.rootCertificateSS;
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- wrongProvider = cf.getProvider();
- usefulProvider = Signature.getInstance("SHA1WithRSA").getProvider();
}
/**
@@ -326,8 +319,11 @@ public class MyModifiablePublicKey implements PublicKey {
CertificateException, NoSuchAlgorithmException,
NoSuchProviderException, SignatureException {
+ final Signature sig = Signature.getInstance("SHA1WithRSA");
+ sig.initVerify(cert.getPublicKey());
+ final Provider provider = sig.getProvider();
// real test
- cert.verify(cert.getPublicKey(), usefulProvider.getName());
+ cert.verify(cert.getPublicKey(), provider.getName());
// Exception tests
@@ -342,6 +338,9 @@ public class MyModifiablePublicKey implements PublicKey {
// a new provider, test if it works, then remove it and test if the
// exception is thrown.
//
+ // CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ // Provider wrongProvider = cf.getProvider();
+ //
// Security.removeProvider(wrongProvider.getName());
//
// try {