Example usage for javax.net.ssl HttpsURLConnection getCipherSuite

List of usage examples for javax.net.ssl HttpsURLConnection getCipherSuite

Introduction

In this page you can find the example usage for javax.net.ssl HttpsURLConnection getCipherSuite.

Prototype

public abstract String getCipherSuite();

Source Link

Document

Returns the cipher suite in use on this connection.

Usage

From source file:com.ct855.util.HttpsClientUtil.java

private void print_https_cert(HttpsURLConnection con) {

    if (con != null) {

        try {/*  w  w w.  jav  a2  s. c om*/

            System.out.println("Response Code : " + con.getResponseCode());
            System.out.println("Cipher Suite : " + con.getCipherSuite());
            System.out.println("\n");

            Certificate[] certs = con.getServerCertificates();
            for (Certificate cert : certs) {
                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");
            }

        } catch (SSLPeerUnverifiedException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}