To help troubleshooting the PKIClient class has been modified to
log the certificate chain retrieved from the CA.

https://fedorahosted.org/pki/ticket/2399

Pushed under one-liner/trivial rule.

--
Endi S. Dewata
>From e46fdb07d014368bb506b02d4ca9fafda672800a Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edew...@redhat.com>
Date: Sat, 30 Jul 2016 00:23:48 +0200
Subject: [PATCH] Added log message in PKIClient.

To help troubleshooting the PKIClient class has been modified to
log the certificate chain retrieved from the CA.

https://fedorahosted.org/pki/ticket/2399
---
 base/common/src/com/netscape/certsrv/client/PKIClient.java | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/base/common/src/com/netscape/certsrv/client/PKIClient.java b/base/common/src/com/netscape/certsrv/client/PKIClient.java
index 5c13554fe87257bd4606c2a1e6e8828962a19d32..8cad382da6a4ef3252cd6874677354487720e1f9 100644
--- a/base/common/src/com/netscape/certsrv/client/PKIClient.java
+++ b/base/common/src/com/netscape/certsrv/client/PKIClient.java
@@ -32,6 +32,7 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.commons.codec.binary.Base64;
 import org.mozilla.jss.CryptoManager;
 import org.mozilla.jss.CryptoManager.NicknameConflictException;
 import org.mozilla.jss.CryptoManager.NotInitializedException;
@@ -177,7 +178,15 @@ public class PKIClient {
         Element element = (Element)list.item(0);
 
         String encodedChain = element.getTextContent();
-        return Utils.base64decode(encodedChain);
+        byte[] bytes = Utils.base64decode(encodedChain);
+
+        if (verbose) {
+            System.out.println("-----BEGIN PKCS7-----");
+            System.out.print(new Base64(64).encodeToString(bytes));
+            System.out.println("-----END PKCS7-----");
+        }
+
+        return bytes;
     }
 
     public X509Certificate importCertPackage(byte[] bytes, String nickname)
-- 
2.5.5

_______________________________________________
Pki-devel mailing list
Pki-devel@redhat.com
https://www.redhat.com/mailman/listinfo/pki-devel

Reply via email to