You dont have to do this. I need it because i used certs generated by openssl. The ssl cert used on server side does not have the proper url. Without this the ssl handshake failed. Greetings, Erwin
-----Oorspronkelijk bericht----- Van: Shimpa Mithal [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 20 maart 2007 15:19 Aan: [email protected] Onderwerp: RE: Client certificate authentication Hi Erwin, Thanks for your response. Why do you have to implement the registerMyHostnameVerifier() method ? TIA Erwin Reinhoud <[EMAIL PROTECTED]> wrote: This is what i do before making the call to the web service: String pwd =props.getProperty("clientkeystorepassword").trim(); clientKeystoreLocation = props.getProperty("clientkeystorelocation").trim(); clientkeystoreType = props.getProperty("clientkeystoretype").trim(); String tpwd =props.getProperty("truststorepassword").trim(); truststoreLocation = props.getProperty("truststorelocation").trim(); truststoreType = props.getProperty("truststoretype").trim(); System.setProperty("javax.net.ssl.keyStoreType",clientkeystoreType); System.setProperty("javax.net.ssl.keyStore", clientKeystoreLocation); System.setProperty("javax.net.ssl.keyStorePassword", pwd); System.setProperty("javax.net.ssl.trustStore", truststoreLocation); System.setProperty("javax.net.ssl.trustStorePassword", tpwd); System.setProperty("javax.net.ssl.trustStoreType",truststoreType); System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol"); System.setProperty("javax.net.debug","all"); System.setProperty("java.security.debug","all"); Security.addProvider( new com.sun.net.ssl.internal.ssl.Provider() ); If you are using your own certs that dont have correct url you als need to disable this check (NOT FOR PRODUCTION): private void registerMyHostnameVerifier() { javax.net.ssl.HostnameVerifier myHv = new javax.net.ssl.HostnameVerifier() { public boolean verify(String hostName,javax.net.ssl.SSLSession session) { return true; } }; HttpsURLConnection.setDefaultHostnameVerifier(myHv); } Greetings, Erwin -----Oor spronkelijk bericht----- Van: Shimpa Mithal [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 20 maart 2007 5:13 Aan: [email protected] Onderwerp: Client certificate authentication I am trying to authenticate my client to an AXIS web service. I have a valid certificate to the service ... I want to know how do I attach the certificate to this standalone JAVA client so that the service will recognize it. The service is running on Tomcat. The standalone JAVA (along with the cert )will be distributed to specific users. Thanks Shimpa _____ Don't be flakey. Get <http://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mail> Yahoo! Mail for Mobile and always <http://us.rd.yahoo.com/evt=43909/*http://mobile.yahoo.com/mail> stay connected to friends. _____ Never <http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/> miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. <http://us.rd.yahoo.com/evt=49937/*http://tools.search.yahoo.com/toolbar/features/mail/> Check it out.
