Changeset 650 for raptor-client


Ignore:
Timestamp:
04/06/11 23:35:59 (9 years ago)
Author:
philsmart
Message:
 
Location:
raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/Endpoint.java

    r639 r650  
    3535    private AttributeFilterPolicy attributeFilterPolicy; 
    3636 
    37     /** They public key used to encrypt messages sent to this endpoint*/ 
    38     private String publicKey; 
    39  
    40     /** The password used to access the public key */ 
    41     private String publicKeyPassword; 
    42  
    4337    public void setServiceEndpoint(String serviceEndpoint) { 
    4438        this.serviceEndpoint = serviceEndpoint; 
     
    6559    } 
    6660 
    67     /** 
    68      * @param publicKey the publicKey to set 
    69      */ 
    70     public void setPublicKey(String publicKey) { 
    71         this.publicKey = publicKey; 
    72     } 
    73  
    74     /** 
    75      * @return the publicKey 
    76      */ 
    77     public String getPublicKey() { 
    78         return publicKey; 
    79     } 
    80  
    81     /** 
    82      * @param publicKeyPassword the publicKeyPassword to set 
    83      */ 
    84     public void setPublicKeyPassword(String publicKeyPassword) { 
    85         this.publicKeyPassword = publicKeyPassword; 
    86     } 
    87  
    88     /** 
    89      * @return the publicKeyPassword 
    90      */ 
    91     public String getPublicKeyPassword() { 
    92         return publicKeyPassword; 
    93     } 
     61     
    9462 
    9563 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/EndpointRegistry.java

    r595 r650  
    3030    /** Class logger. */ 
    3131    private final Logger log = LoggerFactory.getLogger(EndpointRegistry.class); 
     32    
    3233 
    3334    /** List of endpoints for invoking methods on*/ 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/registry/EventReleaseEngine.java

    r639 r650  
    4242        private AttrributeFilterEngine attributeFilterEngine; 
    4343        private ServiceEndpointClient serviceEndpointInterface; 
     44         
     45        /** The public certificates for trusted servers*/ 
     46        private String trustStoreLocation; 
     47         
     48        /** The private certificate for this client */ 
     49        private String keyStoreLocation; 
     50         
     51        /** The password for the trust store*/ 
     52        private String trustStorePassword; 
     53         
     54        /** The password for the key store */ 
     55        private String keyStorePassword; 
    4456 
    4557        /** Class logger */ 
     
    128140        } 
    129141 
     142        public void setTrustStoreLocation(String trustStoreLocation) { 
     143                this.trustStoreLocation = trustStoreLocation; 
     144        } 
     145 
     146        public String getTrustStoreLocation() { 
     147                return trustStoreLocation; 
     148        } 
     149 
     150        public void setKeyStoreLocation(String keyStoreLocation) { 
     151                this.keyStoreLocation = keyStoreLocation; 
     152        } 
     153 
     154        public String getKeyStoreLocation() { 
     155                return keyStoreLocation; 
     156        } 
     157 
     158        public void setTrustStorePassword(String trustStorePassword) { 
     159                this.trustStorePassword = trustStorePassword; 
     160        } 
     161 
     162        public String getTrustStorePassword() { 
     163                return trustStorePassword; 
     164        } 
     165 
     166        public void setKeyStorePassword(String keyStorePassword) { 
     167                this.keyStorePassword = keyStorePassword; 
     168        } 
     169 
     170        public String getKeyStorePassword() { 
     171                return keyStorePassword; 
     172        } 
     173 
    130174} 
  • raptor-client/trunk/src/main/java/uk/ac/cardiff/raptor/remoting/client/sei/impl/CxfServiceEndpointClient.java

    r646 r650  
    5353    /** Class logger */ 
    5454    private final Logger log = LoggerFactory.getLogger(CxfServiceEndpointClient.class); 
     55     
     56    /** TLS parameters */ 
     57    private TLSClientParameters tlsParameters; 
    5558 
    5659    @Override 
     
    9396            httpConduit.setClient(httpClientPolicy); 
    9497 
    95             TLSClientParameters tls = new TLSClientParameters(); 
    96  
    97             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 
    110             KeyStore keyStore = KeyStore.getInstance("JKS"); 
    111             File truststore = new File(endpoint.getPublicKey()); 
    112             keyStore.load(new FileInputStream(truststore),  endpoint.getPublicKeyPassword().toCharArray()); 
    113             TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 
    114             trustFactory.init(keyStore); 
    115  
    116             TrustManager[] tm = trustFactory.getTrustManagers(); 
    117             tls.setTrustManagers(tm); 
    118  
    119  
    120             httpConduit.setTlsClientParameters(tls); 
     98           
     99            if (tlsParameters!=null) 
     100                httpConduit.setTlsClientParameters(tlsParameters); 
    121101 
    122102            log.debug("Accessing the endpoint version " + client.getVersion()); 
     
    136116 
    137117    } 
     118     
     119    private TLSClientParameters getTlsSettings(){ 
     120         TLSClientParameters tls = new TLSClientParameters(); 
     121 
     122            tls.setDisableCNCheck(true);//disable URL and CN on cert match 
     123 
     124            //clients private 
     125            KeyStore keyStoreKeyManager = KeyStore.getInstance("JKS"); 
     126            File keyStoreFile = new File("/Users/philsmart/Documents/Java/RaptorWorkspace/keys/raptor-ica.jks"); 
     127            keyStoreKeyManager.load(new FileInputStream(keyStoreFile),  "phil11".toCharArray()); 
     128            KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); 
     129            keyFactory.init(keyStoreKeyManager, "phil11".toCharArray()); 
     130 
     131            KeyManager[] km = keyFactory.getKeyManagers(); 
     132            tls.setKeyManagers(km); 
     133 
     134            //servers public key 
     135            KeyStore keyStore = KeyStore.getInstance("JKS"); 
     136            File truststore = new File(endpoint.getPublicKey()); 
     137            keyStore.load(new FileInputStream(truststore),  endpoint.getPublicKeyPassword().toCharArray()); 
     138            TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); 
     139            trustFactory.init(keyStore); 
     140 
     141            TrustManager[] tm = trustFactory.getTrustManagers(); 
     142            tls.setTrustManagers(tm); 
     143 
     144    } 
    138145} 
Note: See TracChangeset for help on using the changeset viewer.