public static X509Certificate readX509Certificate(URL url) throws IOException, CertificateException {
  URLConnection connection=url.openConnection();
  InputStream is=connection.getInputStream();
  try {
    CertificateFactory servercf=CertificateFactory.getInstance("X.509");
    return (X509Certificate)servercf.generateCertificate(is);
  }
  finally {
    is.close();
  }
}

public static X509Certificate readX509Certificate ( URL url ) throws IOException , CertificateException { URLConnection connection = url . openConnection ( ) ; InputStream is = connection . getInputStream ( ) ; try { CertificateFactory servercf = CertificateFactory . getInstance ( "X.509" ) ; return ( X509Certificate ) servercf . generateCertificate ( is ) ; } finally { is . close ( ) ; } }
load x . 509 certificate from an url
