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.

Reply via email to