How to specify outbound certificate alias for HTTPS-calls?

后端 未结 4 670
滥情空心
滥情空心 2021-02-05 07:15

I am calling a webservice that requires client certificate authentication.

If I specify a Java keystore containing a single certificate (the client certificate the servi

4条回答
  •  被撕碎了的回忆
    2021-02-05 07:46

    Short answer: it cannot be done with default Java ssl implementation.

    Long answer: I looked on how the SSL handshake is implemented in the sun.security.ssl.ClientHandshaker. In its method serverHelloDone is called X509ExtendedKeyManager.chooseClientAlias. Its implementations are really done in such a way that they return first alias, whose entry matches the given key algorithm and few other things. No way how to tweak the alias selection.

    For those who can change the code, this looks like a promising workaround: http://www.44342.com/java-f392-t785-p1.htm

提交回复
热议问题