Warning: no suitable certificate found - continuing without client authentication

倖福魔咒の 提交于 2019-11-28 11:12:51
  1. The client was unable to find a certificate in its keystore that was signed directly or indirectly by any of the signers mentioned in the CertificateRequest message.
  2. The reason for that was that the server didn't specify any trusted signers in that message.
  3. Which in turn means that the server's truststore is empty.

This is actually an area where the TLS 1.0 specification and TLS 1.1/1.2 differ.

In particular, the following was added to Section 7.4.4 (Certificate Request) in TLS 1.1:

If the certificate_authorities list is empty then the client MAY send any certificate of the appropriate ClientCertificateType, unless there is some external arrangement to the contrary.

So empty Cert Authorities just means client is free to send any certificates to the server, which may or may not be accepted by server's internal rules.

In my case, the problem turned out to be that I was passing in null as the password when loading my key store:

KeyStore keyStore = KeyStore.getInstance("PKCS12")
InputStream inputStream = new FileInputStream('/path/to/mykeystore.p12')

try {
    keyStore.load(inputStream, null); // <-- PROBLEM HERE!
}
finally {
    inputStream.close();
}

This didn't produce any error messages, but it silently failed to load the client key & certificate.

The solution was to pass in the password:

keyStore.load(inputStream as InputStream, 'mypassword'.toCharArray());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!