< prev index next >

src/java.base/share/classes/sun/security/x509/X509CRLImpl.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -368,20 +368,22 @@
         }
         if (signedCRL == null) {
             throw new CRLException("Uninitialized CRL");
         }
         Signature   sigVerf = null;
-        String sigName = sigAlgId.getName();
         if (sigProvider.isEmpty()) {
-            sigVerf = Signature.getInstance(sigName);
+            sigVerf = Signature.getInstance(sigAlgId.getName());
         } else {
-            sigVerf = Signature.getInstance(sigName, sigProvider);
+            sigVerf = Signature.getInstance(sigAlgId.getName(), sigProvider);
         }
 
+        sigVerf.initVerify(key);
+
+        // set parameters after Signature.initSign/initVerify call,
+        // so the deferred provider selection happens when key is set
         try {
-            SignatureUtil.initVerifyWithParam(sigVerf, key,
-                SignatureUtil.getParamSpec(sigName, getSigAlgParams()));
+            SignatureUtil.specialSetParameter(sigVerf, getSigAlgParams());
         } catch (ProviderException e) {
             throw new CRLException(e.getMessage(), e.getCause());
         } catch (InvalidAlgorithmParameterException e) {
             throw new CRLException(e);
         }

@@ -421,20 +423,22 @@
 
         if (signedCRL == null) {
             throw new CRLException("Uninitialized CRL");
         }
         Signature sigVerf = null;
-        String sigName = sigAlgId.getName();
         if (sigProvider == null) {
-            sigVerf = Signature.getInstance(sigName);
+            sigVerf = Signature.getInstance(sigAlgId.getName());
         } else {
-            sigVerf = Signature.getInstance(sigName, sigProvider);
+            sigVerf = Signature.getInstance(sigAlgId.getName(), sigProvider);
         }
 
+        sigVerf.initVerify(key);
+
+        // set parameters after Signature.initSign/initVerify call,
+        // so the deferred provider selection happens when key is set
         try {
-            SignatureUtil.initVerifyWithParam(sigVerf, key,
-                SignatureUtil.getParamSpec(sigName, getSigAlgParams()));
+            SignatureUtil.specialSetParameter(sigVerf, getSigAlgParams());
         } catch (ProviderException e) {
             throw new CRLException(e.getMessage(), e.getCause());
         } catch (InvalidAlgorithmParameterException e) {
             throw new CRLException(e);
         }

@@ -496,11 +500,11 @@
             else
                 sigEngine = Signature.getInstance(algorithm, provider);
 
             sigEngine.initSign(key);
 
-            // in case the name is reset
+                                // in case the name is reset
             sigAlgId = AlgorithmId.get(sigEngine.getAlgorithm());
             infoSigAlgId = sigAlgId;
 
             DerOutputStream out = new DerOutputStream();
             DerOutputStream tmp = new DerOutputStream();
< prev index next >