code: public static X500Name asX500Name(X500Principal p) {
          try {
              X500Name name = (X500Name)principalField.get(p);
              name.x500Principal = p;
              return name;
          } catch (Exception e) {
              throw new RuntimeException("Unexpected exception", e);
          }
      }
docs: Get the X500Name contained in the given X500Principal.
  
  Note that the X500Name is retrieved using reflection.