Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13251

Restlet when used as client use wrong SSL context

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Bug
    • Affects Version/s: 2.23.1
    • Fix Version/s: None
    • Component/s: camel-restlet
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      Discovered during testing link CAMEL-12744.

      I create test: https://github.com/tveskrna/camel/commit/03ca7817676728ed538cbf0d1d003867a33819c9 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:

      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; 

      you can find out there is problem in type of SSL Context and replacing it with right SSL Context, it starts work.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tveskrna Tomas Veskrna
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: