Show KeyOwner info when viewing recovery requests.
    
    This simple fix will grab the subject info out of the cert
    associated with either pending or complete recovery requests being
    viewed in the KRA UI.
    
    For example:
    
    KeyOwner:  UID=jmagne, O=Token Key User
    
    Will be displayed.
    Have seen this display for both pending and completed recovery requests.

    This simple fix should be good enough for this round, despite the bug
    asking about agent info and such. Those enhancements for later.
    
    Ticket : Ticket #1512 : Key owner info missing from the Search results of 
Recovery request
From e817db639484ef61c1a228e3e8651fd835bd4eb1 Mon Sep 17 00:00:00 2001
From: Jack Magne <[email protected]>
Date: Wed, 1 Jun 2016 15:05:20 -0700
Subject: [PATCH] Show KeyOwner info when viewing recovery requests.

This simple fix will grab the subject info out of the cert
associated with either pending or complete recovery requests being
viewed in the KRA UI.

For example:

KeyOwner:  UID=jmagne, O=Token Key User

Will be displayed.
This simple fix should be good enough for this round, despite the bug
asking about agent info and such.

Ticket : Ticket #1512 : Key owner info missing from the Search results of Recovery request
---
 .../netscape/cms/servlet/request/CertReqParser.java  | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/base/server/cms/src/com/netscape/cms/servlet/request/CertReqParser.java b/base/server/cms/src/com/netscape/cms/servlet/request/CertReqParser.java
index fd45894..88f9c5d 100644
--- a/base/server/cms/src/com/netscape/cms/servlet/request/CertReqParser.java
+++ b/base/server/cms/src/com/netscape/cms/servlet/request/CertReqParser.java
@@ -59,6 +59,7 @@ import com.netscape.certsrv.request.RequestStatus;
 import com.netscape.cms.servlet.common.CMSTemplate;
 import com.netscape.cms.servlet.common.CMSTemplateParams;
 import com.netscape.cms.servlet.common.RawJS;
+import com.netscape.cmsutil.util.Utils;
 
 /**
  * Output a 'pretty print' of a certificate request
@@ -666,8 +667,25 @@ public class CertReqParser extends ReqParser {
             arg.addStringValue("profile", "false");
             String keyID = getKeyID(req);
 
-            if (keyID != null) {
+            if (keyID != null && !keyID.isEmpty()) {
                 arg.addStringValue("subject", keyID);
+            } else {
+                String cert = req.getExtDataInString("cert");
+
+                if(cert != null) {
+
+                    X509CertImpl theCert = null;
+                    try {
+                        theCert = new X509CertImpl(Utils.base64decode(cert));
+                    } catch (CertificateException e) {
+                    }
+
+                    if(theCert != null) {
+                        String subject = theCert.getSubjectDN().toString();
+                        arg.addStringValue("subject", subject);
+                    }
+
+                }
             }
         }
 
-- 
2.5.0

_______________________________________________
Pki-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pki-devel

Reply via email to