3

Can someone help me understand how to use HTTPS mutual authentication such that I can programmatically choose which client certificate to use during authentication?

Here is the context of the question. I am using:

  • A JKS containing multiple client certificates
  • Apache SSLContextBuilder to create the SslContext
  • Apache HttpClients to create a CloseableHttpClient
  • Spring HttpComponentsClientHttpRequestFactory to create the RestTemplate

The approach I'm taking is similar to Java Rest call with different user certs and Spring Boot SSL Client. In neither of these examples do I see where the specific alias within the KeyStore is specified.

How can I have an application that initiates multiple mutual HTTPS connections using a distinct client certificate for each connection?

Mark Maxey
  • 811
  • 1
  • 7
  • 9
  • Here are few trivial PrivateKeyStrategy implementations that may help?: - [Lambda](https://github.com/dropwizard/dropwizard/blob/master/dropwizard-client/src/main/java/io/dropwizard/client/DropwizardSSLConnectionSocketFactory.java#L95) -[Anonymous Method](https://stackoverflow.com/a/37775765/1029971) -[Class](http://book2s.com/java/src/package/won/cryptography/ssl/predefinedaliasprivatekeystrategy.html) -[testClientAuthSSLAliasChoice](http://svn.jetbrains.org/teamcity/sandbox/httpclient/trunk/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLSocketFactory.java) – Mark Maxey Mar 21 '18 at 18:36

0 Answers0