/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @exception IOException if we can't verify identity of server */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }
/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @exception IOException if we can't verify identity of server */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }
/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @return true if the RFC 2595 check passes */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }
/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @exception IOException if we can't verify identity of server */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }
/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @exception IOException if we can't verify identity of server */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }
/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @exception IOException if we can't verify identity of server */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }
/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @exception IOException if we can't verify identity of server */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }
/** * Check the server from the Socket connection against the server name(s) * as expressed in the server certificate (RFC 2595 check). * * @param server name of the server expected * @param sslSocket SSLSocket connected to the server * @exception IOException if we can't verify identity of server */ private static void checkServerIdentity(String server, SSLSocket sslSocket) throws IOException { // Check against the server name(s) as expressed in server certificate try { java.security.cert.Certificate[] certChain = sslSocket.getSession().getPeerCertificates(); if (certChain != null && certChain.length > 0 && certChain[0] instanceof X509Certificate && matchCert(server, (X509Certificate)certChain[0])) return; } catch (SSLPeerUnverifiedException e) { sslSocket.close(); IOException ioex = new IOException( "Can't verify identity of server: " + server); ioex.initCause(e); throw ioex; } // If we get here, there is nothing to consider the server as trusted. sslSocket.close(); throw new IOException("Can't verify identity of server: " + server); }