public static X509Certificate loadX509Certificate(final String certificateFile) throws IOException, CertificateException {
  final CertificateFactory cf=CertificateFactory.getInstance("X.509");
  final InputStream inputStream=FileUtils.loadFileByName(certificateFile);
  final X509Certificate certificate=(X509Certificate)cf.generateCertificate(inputStream);
  inputStream.close();
  return certificate;
}

public static X509Certificate loadX509Certificate ( final String certificateFile ) throws IOException , CertificateException { final CertificateFactory cf = CertificateFactory . getInstance ( "X.509" ) ; final InputStream inputStream = FileUtils . loadFileByName ( certificateFile ) ; final X509Certificate certificate = ( X509Certificate ) cf . generateCertificate ( inputStream ) ; inputStream . close ( ) ; return certificate ; }
loads an x509 certificate from the given location .
