8005939: sun/security/x509/{X509CRLImplX509CertImpl}/Verify.java fail in confusing way when some providers not present

Reviewed-by: mullan, weijun
This commit is contained in:
Jason Uh 2013-01-16 13:35:17 -05:00
parent 68eb431db8
commit 5d2a6972af
2 changed files with 10 additions and 2 deletions
jdk/test/sun/security/x509
X509CRLImpl
X509CertImpl

@ -95,7 +95,7 @@ public class Verify {
* Should fail with NoSuchAlgorithmException.
*/
try {
verifyCRL(crlIssuerCertPubKey, "SunPCSC");
verifyCRL(crlIssuerCertPubKey, "SunJCE");
throw new RuntimeException("Didn't catch the exception properly");
} catch (NoSuchAlgorithmException e) {
System.out.println("Caught the correct exception.");
@ -148,6 +148,10 @@ public class Verify {
throws CRLException, NoSuchAlgorithmException, InvalidKeyException,
SignatureException {
Provider provider = Security.getProvider(providerName);
if (provider == null) {
throw new RuntimeException("Provider " + providerName
+ " not found.");
}
crl.verify(key, provider);
}
}

@ -86,7 +86,7 @@ public class Verify {
* Should fail with NoSuchAlgorithmException.
*/
try {
verifyCert(selfSignedCertPubKey, "SunPCSC");
verifyCert(selfSignedCertPubKey, "SunJCE");
throw new RuntimeException("Didn't catch the exception properly");
} catch (NoSuchAlgorithmException e) {
System.out.println("Caught the correct exception.");
@ -134,6 +134,10 @@ public class Verify {
throws CertificateException, NoSuchAlgorithmException,
InvalidKeyException, SignatureException {
Provider provider = Security.getProvider(providerName);
if (provider == null) {
throw new RuntimeException("Provider " + providerName
+ " not found.");
}
cert.verify(key, provider);
}
}