code: @FFDCIgnore(InvalidNameException.class)
      public static String getCNFromDN(String dn) {
          String cn = null;
          try {
              LdapName ldapDN = new LdapName(dn);
              for (int i = ldapDN.size() - 1; i > -1; i--) {
                  //for (int i = 0; i < ldapDN.size(); i++) {
                  if (ldapDN.get(i).toLowerCase().startsWith("cn=")) {
                      cn = ldapDN.get(i).substring(START_CN_OFFSET);
                      break;
                  }
              }
          } catch (InvalidNameException e) {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, "Unable to getCNFromDN: " + e.getMessage(), e);
              }
          }
          return cn;
      }
docs: Extract the common name from a distinguished name, i.e.:
  input "cn=Paul,ou=WebSphere,o=ibm" will return "Paul".
  If it's an invalid dn return null.
  
  @param dn distinguished name
  @return common name