diff options
author | Narayan Kamath <narayan@google.com> | 2015-06-15 11:27:26 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2015-06-15 17:31:45 +0100 |
commit | cfcb7ad5b68ad854ddbfe5ca1afcf85a1bb61f68 (patch) | |
tree | badd0dcc0495b4e41c1270ae5f561a9e63ed5650 /luni/src | |
parent | 9d835973b665a7bcf4601358b44fe2c4a3b833c2 (diff) | |
download | libcore-cfcb7ad5b68ad854ddbfe5ca1afcf85a1bb61f68.zip libcore-cfcb7ad5b68ad854ddbfe5ca1afcf85a1bb61f68.tar.gz libcore-cfcb7ad5b68ad854ddbfe5ca1afcf85a1bb61f68.tar.bz2 |
Fix CertificateTest#testVerifyPublicKeyString2
Use a provider that can handle the provided public-key.
bug: 21816913
Change-Id: Iee7a932a8767c4c1b781636dfb9456a1b604532f
Diffstat (limited to 'luni/src')
-rw-r--r-- | luni/src/test/java/tests/security/cert/CertificateTest.java | 15 |
1 files changed, 7 insertions, 8 deletions
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 { |