code: public static X509Certificate loadCertificate(String file)
              throws IOException, GeneralSecurityException {
  
          if (file == null) {
              throw new IllegalArgumentException("Certificate file is null");
              //i18n
              //  .getMessage("certFileNull"));
          }
  
          X509Certificate cert = null;
  
          BufferedReader reader = new BufferedReader(new FileReader(file));
          try {
              cert = readCertificate(reader);
          } finally {
              reader.close();
          }
  
          if (cert == null) {
              throw new GeneralSecurityException("No certificate data");
              //i18n.getMessage("noCertData"));
          }
  
          return cert;
      }
docs: Loads an X.509 certificate from the specified file. The certificate file
  must be in PEM/Base64 format and start with "BEGIN CERTIFICATE" and end
  with "END CERTIFICATE" line.
  
  @param file the file to load the certificate from.
  @return <code>java.security.cert.X509Certificate</code> the loaded
  certificate.
  @throws IOException              if I/O error occurs
  @throws GeneralSecurityException if security problems occurs.