Tejaskriya commented on code in PR #5078:
URL: https://github.com/apache/ozone/pull/5078#discussion_r1266233002
##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/cert/ListSubcommand.java:
##########
@@ -154,15 +157,41 @@ private static class Certificate {
private BigInteger serialNumber;
private String validFrom;
private String expiry;
- private String subjectDN;
- private String issuerDN;
+ private Map<String, String> subjectDN = new HashMap<>();
+ private Map<String, String> issuerDN = new HashMap<>();;
Certificate(X509Certificate cert) {
serialNumber = cert.getSerialNumber();
validFrom = cert.getNotBefore().toString();
expiry = cert.getNotAfter().toString();
- subjectDN = cert.getSubjectDN().toString();
- issuerDN = cert.getIssuerDN().toString();
+
+ String[] subject = cert.getSubjectDN().getName().split(",");
+ if(subject.length == 0) {
+ err.println("Invalid format of subjectDN name");
+ } else {
+ for(String elem : subject) {
+ String[] subjectComponents = elem.split("=");
+ if(subjectComponents.length == 2) {
+ subjectDN.put(subjectComponents[0], subjectComponents[1]);
+ } else {
+ err.println("Invalid format of subjectDN name");
+ }
+ }
+ }
Review Comment:
I have changed it now, Thank you
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]