Blame SOURCES/pki-core-Fix-CMCResponse-tool.patch

b1e4e4
From a391af8c91b8ad108b4111c0e671bce43193bf19 Mon Sep 17 00:00:00 2001
b1e4e4
From: jmagne <jmagne@redhat.com>
b1e4e4
Date: Thu, 21 May 2020 16:36:44 -0700
b1e4e4
Subject: [PATCH] Related: Bug 1710109 - add RSA PSS support. (#418)
b1e4e4
b1e4e4
This fix is to the CMCRespone tool.
b1e4e4
b1e4e4
The tool currently does not initialize the CryptoManager.
b1e4e4
Doing so is necessary to register the JSS Provider which provides the
b1e4e4
encoding / parsing support for the RSAPSS algorithm parameters.
b1e4e4
b1e4e4
Co-authored-by: Jack Magne <jmagne@test.host.com>
b1e4e4
(cherry picked from commit ece00d4c2cbacf187b9f44873ff70e90497e5ccd)
b1e4e4
---
b1e4e4
 base/java-tools/src/com/netscape/cmstools/CMCResponse.java | 12 ++++++++++--
b1e4e4
 1 file changed, 10 insertions(+), 2 deletions(-)
b1e4e4
b1e4e4
diff --git a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
b1e4e4
index 5d4f6c6..d98ab0a 100644
b1e4e4
--- a/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
b1e4e4
+++ b/base/java-tools/src/com/netscape/cmstools/CMCResponse.java
b1e4e4
@@ -53,6 +53,7 @@ import org.mozilla.jss.pkix.cmc.TaggedAttribute;
b1e4e4
 import org.mozilla.jss.pkix.cms.ContentInfo;
b1e4e4
 import org.mozilla.jss.pkix.cms.EncapsulatedContentInfo;
b1e4e4
 import org.mozilla.jss.pkix.cms.SignedData;
b1e4e4
+import org.mozilla.jss.CryptoManager;
b1e4e4
 
b1e4e4
 import com.netscape.cmsutil.util.Utils;
b1e4e4
 import netscape.security.pkcs.PKCS7;
b1e4e4
@@ -352,8 +353,7 @@ public class CMCResponse {
b1e4e4
 
b1e4e4
         CommandLine cmd = parser.parse(options, args, true);
b1e4e4
 
b1e4e4
-        @SuppressWarnings("unused")
b1e4e4
-        String database = cmd.getOptionValue("d");
b1e4e4
+        String dbdir = cmd.getOptionValue("d");
b1e4e4
 
b1e4e4
         String input = cmd.getOptionValue("i");
b1e4e4
         String output = cmd.getOptionValue("o");
b1e4e4
@@ -370,6 +370,14 @@ public class CMCResponse {
b1e4e4
             System.exit(1);
b1e4e4
         }
b1e4e4
 
b1e4e4
+        //Intialize the crypto manager, just in case we need to use the JSS Provider to parse 
b1e4e4
+        //algorithm parameters. All we have to do is initialize the manager and be done.
b1e4e4
+
b1e4e4
+        if (dbdir == null)
b1e4e4
+            dbdir = ".";
b1e4e4
+
b1e4e4
+        CryptoManager.initialize(dbdir);
b1e4e4
+
b1e4e4
         // load CMC response
b1e4e4
         byte[] data = Files.readAllBytes(Paths.get(input));
b1e4e4
 
b1e4e4
-- 
b1e4e4
1.8.3.1
b1e4e4