Code example for SSLSession

Methods: getPeerCertificates

0
                    session = ssl.getSession();
                } 
            } 
            Certificate[] certs;
            try { 
                certs = session.getPeerCertificates();
            } catch (SSLPeerUnverifiedException spue) {
                InputStream in = ssl.getInputStream();
                in.available();
                // Didn't trigger anything interesting?  Okay, just throw 
                // original. 
                throw spue;
            } 
            X509Certificate x509 = (X509Certificate) certs[0];
            check(host, x509);
        } 
 
        public void check(String[] host, X509Certificate cert)
            throws SSLException { 
 
            String[] cns = Certificates.getCNs(cert);