Changeset 646 for raptor-client


Ignore:
Timestamp:
04/06/11 16:46:44 (9 years ago)
Author:
philsmart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/impl/CxfServiceEndpointClient.java

    r639 r646  
    2323import java.util.Set; 
    2424 
     25import javax.net.ssl.KeyManager; 
     26import javax.net.ssl.KeyManagerFactory; 
    2527import javax.net.ssl.TrustManager; 
    2628import javax.net.ssl.TrustManagerFactory; 
     
    3234import org.apache.cxf.common.classloader.ClassLoaderUtils; 
    3335import org.apache.cxf.configuration.jsse.TLSClientParameters; 
     36import org.apache.cxf.configuration.security.ClientAuthentication; 
    3437import org.apache.cxf.frontend.ClientProxy; 
    3538import org.apache.cxf.frontend.ClientProxyFactoryBean; 
     
    8992            HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); 
    9093            httpConduit.setClient(httpClientPolicy); 
     94 
    9195            TLSClientParameters tls = new TLSClientParameters(); 
     96 
    9297            tls.setDisableCNCheck(true);//disable URL and CN on cert match 
     98 
     99            //clients private 
     100            KeyStore keyStoreKeyManager = KeyStore.getInstance("JKS"); 
     101            File keyStoreFile = new File("/Users/philsmart/Documents/Java/RaptorWorkspace/keys/raptor-ica.jks"); 
     102            keyStoreKeyManager.load(new FileInputStream(keyStoreFile),  "phil11".toCharArray()); 
     103            KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); 
     104            keyFactory.init(keyStoreKeyManager, "phil11".toCharArray()); 
     105 
     106            KeyManager[] km = keyFactory.getKeyManagers(); 
     107            tls.setKeyManagers(km); 
     108 
     109            //servers public key 
    93110            KeyStore keyStore = KeyStore.getInstance("JKS"); 
    94111            File truststore = new File(endpoint.getPublicKey()); 
     
    96113            TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 
    97114            trustFactory.init(keyStore); 
     115 
    98116            TrustManager[] tm = trustFactory.getTrustManagers(); 
    99117            tls.setTrustManagers(tm); 
     118 
     119 
    100120            httpConduit.setTlsClientParameters(tls); 
    101121 
Note: See TracChangeset for help on using the changeset viewer.