Java server self-signed certificate + client certificate and SSL - connection reset

放肆的年华 提交于 2019-12-04 11:47:05

Problem solved.

I did this:

openssl pkcs8 -topk8 -nocrypt -outform der -in clientkey.pem -out clientkey.der

But I didn't do this:

openssl x509 -outform der -in clientkey.pem -out clientkey.cer

Both files need to be imported into keystore through Java, not keytool. I was importing only the clientkey.der.

Turns out you have to separately import client key and server certificate in keystore; I wasn't aware that converting .pem to .der didn't export attached server certificate as well.

'Connection reset' usually means you have written to a connection which has already been closed by the other end. There are numerous other causes but this is the most likely. In this case it appears you are in the middle of the SSL handshake. Possibly you need to disable SSLv2ClientHello in the enabled protocols.

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