import java.net.*; import java.security.cert.Certificate; import java.io.*; import javax.net.ssl.*; public class SSLTest { public static void main(String[] args) throws Exception { String https_url = "https://www.google.com/"; URL url; url = new URL(https_url); HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); if (con != null) { System.out.println("Response Code : " + con.getResponseCode()); System.out.println("Cipher Suite : " + con.getCipherSuite()); System.out.println("\n"); Certificate[] certs = con.getServerCertificates(); int i=0; for (Certificate cert : certs) { System.out.println("Cert NO : "+i++); System.out.println("Cert Type : " + cert.getType()); System.out.println("Cert Hash Code : " + cert.hashCode()); System.out.println("Cert Public Key Algorithm : " + cert.getPublicKey().getAlgorithm()); System.out.println("Cert Public Key Format : " + cert.getPublicKey().getFormat()); System.out.println("\n"); } System.out.println("****** Content of the URL ********"); BufferedReader br =new BufferedReader(new InputStreamReader(con.getInputStream())); String input; while ((input = br.readLine()) != null) { System.out.println(input); } br.close(); } } }
Using SSL in java program
Subscribe to:
Post Comments (Atom)
Popular Posts
-
HSQLDB is a portable RDBMS implemented in pure java. It can be embedded with your application as well as can be used separately. It is very ...
-
If you want to use the database into your web application, you can use the HSQLDB in In_Process mode. In this mode, you can embed the HSQLD...
-
HTML Page < html > < head > < title > welcome </ title > < script language = "javascript"...
-
In web application ApplicationContext is created using Context Loaders. there are two implementations of context loader. ContextLoaderLis...
-
JSP code <%@page import="java.sql.*"%> <%! int prod_id=1; String prod_name="Laptop"; int qty=2; float p...
-
HSQLDB database it a very small database that can be controlled from you application. you can start and stop the database by writing the ...
-
Some time you will see the form containing the button " Add More " . This facility is provided for the user to get the values ...
-
StudentRegistration │ index.html │ login.html │ └───WEB-INF │ web.xml │ └───classes login.class lo...
-
package process; import javax.swing. * ; import javax.swing.table. * ; import java.sql. * ; /** * This class create JTable from Da...
-
Hibernate ORM framework does not provide any approch to connect to MS Access database. Unfortunately, Access is not supported officially...
No comments:
Post a Comment