DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20690>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20690

Custom TrustManager for SSL not being used in Tomcat

           Summary: Custom TrustManager for SSL not being used in Tomcat
           Product: Tomcat 4
           Version: 4.1.24
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Unknown
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have coded a custom TrustManger and HostnameVerifier for SSL (actually TLS)
connections from my servlet code to another server.

The code calls the correct methods to setup the Default TrustManager and
HostNameVerifier for an HttpsUrlConnection.

I then use the URL.openConnection() method to instansiate the connection.

Running standalone, this code works perfectly, however running under Tomcat on
the same machine the HttpConnection does not use the custom TustManager that I
coded.

Code to set up default Trust Manager, etc.:

private static void initSSL()
{
  try
  {
    TrustManager[] myTM = new TrustManager [] { new ProxyTrustManager() };
    SSLContext ctx = SSLContext.getInstance("TLS");
    ctx.init(null, myTM, null);
    SSLSocketFactory sslFactory = ctx.getSocketFactory();
    HttpsURLConnection.setDefaultSSLSocketFactory(sslFactory);
    HttpsURLConnection.setDefaultHostnameVerifier(new ProxyHostNameVerifier());
  }
  catch (Exception ex)
  {
    ex.printStackTrace();
  }
}


Machine Specs.:
Red-Hat Linux 7.1
J2SDK SE 1.4.1_02

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to