diff options
author | Alex Klyubin <klyubin@google.com> | 2015-06-10 17:16:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-10 17:16:01 +0000 |
commit | eb80877fdf508af478bf59b338cab127abc54d9a (patch) | |
tree | 88be55d12b09ddd4136931adf9fd6ffc4ecf95e6 /harmony-tests/src/test/java/org | |
parent | 55b99f82dbdbe971914b47ef9262801046dd4f5a (diff) | |
parent | 0c1fd5ae392a0d28481cd5680f0dce25e04409b5 (diff) | |
download | libcore-eb80877fdf508af478bf59b338cab127abc54d9a.zip libcore-eb80877fdf508af478bf59b338cab127abc54d9a.tar.gz libcore-eb80877fdf508af478bf59b338cab127abc54d9a.tar.bz2 |
Merge "Fix X509CertificateTest.testVerifyPublicKeyString failure." into mnc-dev
Diffstat (limited to 'harmony-tests/src/test/java/org')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java index 26403f5..093e2e1 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/security/cert/X509CertificateTest.java @@ -39,6 +39,7 @@ import java.security.Principal; import java.security.Provider; import java.security.PublicKey; import java.security.Security; +import java.security.Signature; import java.security.SignatureException; import java.security.Provider.Service; import java.security.cert.CertificateFactory; @@ -763,16 +764,16 @@ public class X509CertificateTest extends TestCase { } Security.addProvider(myProvider); - Provider[] providers = Security.getProviders("Signature.MD5withRSA"); - if (providers == null || providers.length == 0) { - fail("no Provider for Signature.MD5withRSA"); - return; - } + // Find the Provider which offers MD5withRSA for the certificate's + // public key. + Signature signature = Signature.getInstance("MD5withRSA"); + signature.initVerify(javaxSSCert.getPublicKey()); + Provider provider = signature.getProvider(); // self signed cert: should verify with provider try { javaxSSCert.verify(javaxSSCert.getPublicKey(), - providers[0].getName()); + provider.getName()); } catch (SignatureException e) { fail("blu"); } |