0

A dynamic SSL configuration has been created on IBM WebSphere that embeds a certificate in outgoing requests, you do not need to specify the paths to jks in the code. How can I configure sending a rest request so that HttpClient does not search for certificates in IBM jdk if the request comes via https?

CloseableHttpClient httpClient = null;
    HttpClientBuilder builder = HttpClientBuilder
            .create()
            .useSystemProperties();
            
    httpClient = builder.build();
    HttpPost request = new HttpPost("https://test.org:8081/add");

    // add request headers
    request.addHeader("custom-key", "rev");
    request.addHeader(HttpHeaders.USER_AGENT, "lebot");

    CloseableHttpResponse response = httpClient.execute(request);
  • What do you mean by "embeds a certificate in outgoing requests"? Are you talking about HTTPS server certificate or simply about a certificate sent as HTTP response to the client? – Robert Jul 02 '21 at 15:15
  • This is a dynamic SSL configuration for ibm websphere. On the application server from where we send the request, a dynamic SSL configuration is configured to this address https://test.org:8081/add. On the receiving side( https://test.org:8081/add) SSL certificates are also configured – works-mails Jul 05 '21 at 17:23
  • That is done in Java using an SSLContext that contains the trust store and a key store with the client certificate +private key https://stackoverflow.com/a/46821977/150978 – Robert Jul 05 '21 at 17:33
  • I do not know the passwords from the certificate, this is private information.In a neighboring project, the same dynamic configuration of certificates works great using RestTemplate, but in my project I can't use RestTemplate Here is an example of the code for calling a request via https that works ResponseEntity response = new RestTemplate (). exchange(https://test.org:8081/add, HttpMethod. POST, new HttpEntity<>(request), Void.class); – works-mails Jul 05 '21 at 19:51

0 Answers0