我对SSL相当陌生,并且受到了已知问题的打击。 我的应用程序是SSL客户端,它调用为双向SSL启用的另一个组件。 两个组件中的证书均正确,有时连接正常。 每个服务器都有自己的服务器证书和私钥,但具有相同的根证书和中间证书。
服务器中的SSL检查是在Apache SW LB中完成的。
|-------------|
/ | Tomcat1 |
|-------------| / |-------------|
|---------->|Apache SW LB |/
| |-------------|\
| \
| \ |-------------|
|-----------| |------------| | | Tomcat 2 |
|SSL Client |---HTTPS--->|Hardware LB |------| |-------------|
|-----------| |------------| | |-------------|
| / | Tomcat3 |
| |-------------| / |-------------|
|---------->|Apache SW LB |/
|-------------|\
\
\|-------------|
| Tomcat4 |
|-------------|
有时我遇到如下错误:
***
%% Invalidated: [Session-10, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256]
http-nio-8443-exec-10, SEND TLSv1.2 ALERT: fatal, description = bad_certificate
http-nio-8443-exec-10, WRITE: TLSv1.2 Alert, length = 2
[Raw write]: length = 7
0000: 15 03 03 00 02 02 2A ......*
http-nio-8443-exec-10, called closeSocket()
http-nio-8443-exec-10, handling exception: javax.net.ssl.SSLHandshakeException: server certificate change is restricted during renegotiation
我正在使用Spring REST模板来调用REST调用,并且仅使用TLS_V1.2,但是仍然出现上述错误。
TrustStrategy ts = new TrustStrategy() {
@Override
public boolean isTrusted(
X509Certificate[] x509Certificates, String s)
throws CertificateException {
return true; // TODO : revisit
}
};
SSLContext sslcontext = org.apache.http.ssl.SSLContexts.custom()
.loadKeyMaterial(keyStore, keypass.toCharArray())
.loadTrustMaterial(trustStore, ts)
.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslcontext, new String[] {
"TLSv1.2" }, null,
SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
return HttpClients.custom().setSSLSocketFactory(sslsf).build();
}
在谷歌搜索时,我发现对于TLSv1.2和Java 8(java版本“ 1.8.0_60”)不会发生此问题。 我正在使用Spring 4 RestTemplete来调用rest调用。
我正在使用以下版本的httpclinet:-
org.apache.httpcomponents
httpclient
4.4.1
由于我是SSL新手,因此我有几个问题要开始:-
1)。 这是SSL客户端或SSL服务器问题吗?
2)。 有时连接正常并且有时断开的任何真正原因是失败的技术原因。
3)。 这与客户端的任何缓存有关吗
如果有人可以指出此问题的真正原因,那也很好。