Tomas Veskrna  created CAMEL-13251:
--------------------------------------

             Summary: Restlet when used as client use wrong SSL context
                 Key: CAMEL-13251
                 URL: https://issues.apache.org/jira/browse/CAMEL-13251
             Project: Camel
          Issue Type: Improvement
          Components: camel-restlet
    Affects Versions: 2.23.1
            Reporter: Tomas Veskrna 


Discovered during testing link CAMEL-12744.
 I create test: 
[https://github.com/tveskrna/camel/commit/3bdb3d26bc3642061209408d0402f213aeb39700]
 when Restlet producer using SSL. This test fails. In closer view you can find 
it is SSL handshake error.

When you replace code on: 
[https://github.com/apache/camel/blob/master/components/camel-restlet/src/main/java/org/apache/camel/component/restlet/RestletProducer.java#L59]
 with:
{code:java}
 final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(new 
FileInputStream(new File("path/to/keystore/in/restlet")), 
"changeit".toCharArray()); final KeyManagerFactory kmf = 
KeyManagerFactory.getInstance(Security.getProperty("ssl.KeyManagerFactory.algorithm"));
 kmf.init(ks, "changeit".toCharArray()); final TrustManagerFactory tmf = 
TrustManagerFactory.getInstance(Security.getProperty("ssl.KeyManagerFactory.algorithm"));
 tmf.init(ks); final SSLContext sslContext = SSLContext.getInstance("TLS"); 
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); return 
sslContext; {code}
you can find out there is problem in type of SSL Context and replacing it with 
right SSL Context, it starts work.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to