Title: RE: Problem with custom TrustManager for SSL in Tomcat 4.1.24

Try using

        import com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnectionOldImpl;
            HttpsURLConnectionOldImpl.setDefaultSSLSocketFactory(sslFactory);

instead of
 
        HttpsURLConnection.setDefaultSSLSocketFactory(sslFactory);

(It's deprecated, but it works for me.)

I haven't the faintest idea what Tomcat does to break this. I asked here a few weeks back, but if anyone knows, they aren't telling.

PJDM
--
Peter Mayne
Technology Consultant
Spherion Technology Solutions
Level 1, 243 Northbourne Avenue, Lyneham, ACT, 2602
T: 61 2 62689727  F: 61 2 62689777

> -----Original Message-----
> From: Nathan Christiansen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 12 June 2003 5:33 AM
> To: [EMAIL PROTECTED]
> Subject: Problem with custom TrustManager for SSL in Tomcat 4.1.24
>
>
> 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.
>
> Any suggestions?
>
>
> 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();
>   }
> }
>
>
> -- Nathan Christiansen
>    Tahitian Noni International
>    http://www.tahitiannoni.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

The information contained in this email and any attachments to it:

(a) may be confidential and if you are not the intended recipient, any interference with, 
use, disclosure or copying of this material is unauthorised and prohibited; and

(b) may contain personal information of the recipient and/or the sender as defined 
under the Privacy Act 1988 (Cth). Consent is hereby given by the recipient(s) to 
collect, hold and use such information and any personal information contained in a 
response to this email, for any reasonable purpose in the ordinary course of 
Spherion's 
business, including forwarding this email internally or disclosing it to a third party. All 
personal information collected by Spherion will be handled in accordance with 
Spherion's Privacy Policy. If you have received this email in error, please notify the 
sender and delete it.

(c) you agree not to employ or arrange employment for any candidate(s) supplied in 
this email and any attachments without first entering into a contractual agreement with 
Spherion. You further agree not to divulge any information contained in this document 
to any person(s) or entities without the express permission of Spherion.


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

Reply via email to