code: public static X500Name getX500Name(PrincipalIndentifier principal)
      {
          if (principal instanceof BcPrincipalIdentifier) {
              return ((BcPrincipalIdentifier) principal).getX500Name();
          } else {
              return new X500Name(principal.getName());
          }
      }
docs: Convert principal identifier to X.500 name.
  
  @param principal principal identifier to convert.
  @return an X.500 name.