tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bell <nb...@companioncorp.com>
Subject IOException: HTTPS hostname wrong
Date Fri, 01 Mar 2002 22:06:42 GMT
I receive an "IOException: HTTPS hostname wrong" exception when using a 
self-signed certificate for SSL connections. I know that this should 
happen so to prevent bad people from fooling me, but I need to turn it 
off for testing purposes. I have tryed to cicurmvent this feature using 
HttpsURLConnection.setDefaultHostnameVerifier() to use a class that lets 
every hostname be correct. Tomcat 4.0.1 seems to be ignoring this, and 
using it's own HostnameVerifier instead. I would use 4.0.2 but there are 
problems with it and my servlet getting along.
Is there a different way to get Tomcat to ignore incorrect hostnames? or 
maybe I'm just doing it wrong?
I've included the code snippet that seems to hate me: It seems to work 
perfect for certificates that have the correct hostname.

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("java.protocol.handler.pkgs", 
"com.sun.net.ssl.internal.ssl.protocol");

System.setProperty("javax.net.ssl.keyStore",keyStorePath1);
System.setProperty("javax.net.ssl.keyStorePassword",keyStorePassPhrase1);

if(!checkCertificates)
{
    System.setProperty("javax.net.ssl.trustStore",keyStorePath2);
    
System.setProperty("javax.net.ssl.trustStorePassword",keyStorePassPhrase2);
   
    HttpsURLConnection.setDefaultHostnameVerifier(
        new HostnameVerifier()
        {
            public boolean verify(String urlHostname, String certHostname)
                {
                    return true;
                }
        } );
}

-- 
Nathan Bell
Companion Corporation
Evelyn Manufacturing
www.companioncorp.com
nbell@companioncorp.com

 ><));>



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message