Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > probing SSL websites

Reply
Thread Tools

probing SSL websites

 
 
Roedy Green
Guest
Posts: n/a
 
      01-17-2013
Is there an easy way to find out the certificate details of the SSL
cert a site is using, in particular what root certs you need for it to
be recognised?

When do a probe an SSL website in Java, and you don't have the
necessary root, what is supposed to happen? It seems to act as if the
site just did not respond.
--
Roedy Green Canadian Mind Products http://mindprod.com
The first 90% of the code accounts for the first 90% of the development time.
The remaining 10% of the code accounts for the other 90% of the development
time.
~ Tom Cargill Ninety-ninety Law
 
Reply With Quote
 
 
 
 
Arne Vajh°j
Guest
Posts: n/a
 
      01-18-2013
On 1/17/2013 8:09 AM, Roedy Green wrote:
> Is there an easy way to find out the certificate details of the SSL
> cert a site is using, in particular what root certs you need for it to
> be recognised?


The following may reveal somnething:

import java.io.IOException;
import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;

import javax.net.ssl.HttpsURLConnection;


public class CertSniff {
public static void dump(String urlstr) throws NoSuchAlgorithmException,
KeyManagementException, IOException {
System.out.println("URL=" + urlstr);
URL url = new URL(urlstr);
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
if (con.getResponseCode() == HttpsURLConnection.HTTP_OK) {
for(Certificate cert : con.getServerCertificates()) {
if(cert instanceof X509Certificate) {
X509Certificate cert509 = (X509Certificate)cert;
System.out.println("Subject = " + cert509.getSubjectDN());
System.out.println("Issuer = " + cert509.getIssuerDN());
} else {
System.out.println("Unknown certificate");
}
}
} else {
System.out.println("Connection problem");
}
con.disconnect();

}
public static void main(String[] args) throws Exception {
dump("https://www.google.com/");
dump("https://www.facebook.com/");
dump("https://www.microsoft.com/");
}
}

Arne

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource Probing Issue - Troubleshooting help? =?Utf-8?B?VHlydmVu?= ASP .Net 0 03-27-2005 04:15 AM
SystemC + VHDL cosim, hierarchy probing, etc... jjohnson@cs.ucf.edu VHDL 2 12-20-2004 05:05 PM
<probing> element in Web.config Jiho Han ASP .Net 2 06-08-2004 01:30 PM
Assembly probing does not work Pavils Jurjans ASP .Net 2 05-12-2004 07:04 AM
Re: Assembly probing for Web app with subfolders Stan ASP .Net 1 10-20-2003 01:44 AM



Advertisments