Recently there is a business communication mode for HTTPS bidirectional authentication, and then the very easy to generate the HTTPS certificate, and then fell into the pit.
When debugging the code, encountered an error sslhandshakeexception:remote host closed connection during handshake
Then it is said on the Internet that the TSL protocol version is not correct, or OpenSSL, JDK, Tomcat version is not correct, and so on. Then is the constant change of parameters, change the version, change the environment, but the problem has not been resolved.
This time, I have a hunch that the direction of the problem may not be correct. Then we started looking for problems in other directions, and later tested to find out the nature of the problem--- the validity of the certificate
The newly generated certificate is valid from the next day, so when used immediately, it will be reported Sslhandshakeexception:remote host closed connection during handshake. But this error, and no hint of specific errors, let the developers around a big circle. So, it's important to be able to write the error message and error tracking information.
So how to solve the problem that the certificate is not in the validity period, an easy way is to change the local system time to tomorrow, and then you can pass the test (if the certificate itself is not a problem)