From e46fdb07d014368bb506b02d4ca9fafda672800a Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Sat, 30 Jul 2016 00:23:48 +0200 Subject: 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(-) (limited to 'base/common/src') diff --git a/base/common/src/com/netscape/certsrv/client/PKIClient.java b/base/common/src/com/netscape/certsrv/client/PKIClient.java index 5c13554fe..8cad382da 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) -- cgit