Мы используем jdk1.7.181 с TLS1.2, те же коды и тот же JDK хорошо работают при вызове основного метода, но неправильно при развертывании в tomcat, кто знает проблему?
trigger seeding of SecureRandom
done seeding SecureRandom
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
%% No cached client session
*** ClientHello, TLSv1.2
RandomCookie: GMT: 1527096922 bytes = { 11, 70, 245, 41, 148, 8, 15, 222, 160, 46, 95, 4, 244, 22, 220, 24, 237, 143, 195, 178, 214, 83, 10, 46, 142, 195, 221, 253 }
Session ID: {}
Cipher Suites: [TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256]
Compression Methods: { 0 }
Extension elliptic_curves, curve names: {secp256r1, secp384r1, secp521r1, sect283k1, sect283r1, sect409k1, sect409r1, sect571k1, sect571r1, secp256k1}
Extension ec_point_formats, formats: [uncompressed]
Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
Extension extended_master_secret
Extension renegotiation_info, renegotiated_connection: <empty>
***
[write] MD5 and SHA1 hashes: len = 114
0000: 01 00 00 6E 03 03 5B 06 A6 5A 0B 46 F5 29 94 08 ...n..[..Z.F.)..
0010: 0F DE A0 2E 5F 04 F4 16 DC 18 ED 8F C3 B2 D6 53 ...._..........S
0020: 0A 2E 8E C3 DD FD 00 00 02 C0 27 01 00 00 43 00 ..........'...C.
0030: 0A 00 16 00 14 00 17 00 18 00 19 00 09 00 0A 00 ................
0040: 0B 00 0C 00 0D 00 0E 00 16 00 0B 00 02 01 00 00 ................
0050: 0D 00 16 00 14 06 03 06 01 05 03 05 01 04 03 04 ................
0060: 01 04 02 02 03 02 01 02 02 00 17 00 00 FF 01 00 ................
0070: 01 00 ..
pool-1-thread-1, WRITE: TLSv1.2 Handshake, length = 114
[Raw write]: length = 119
0000: 16 03 03 00 72 01 00 00 6E 03 03 5B 06 A6 5A 0B ....r...n..[..Z.
0010: 46 F5 29 94 08 0F DE A0 2E 5F 04 F4 16 DC 18 ED F.)......_......
0020: 8F C3 B2 D6 53 0A 2E 8E C3 DD FD 00 00 02 C0 27 ....S..........'
0030: 01 00 00 43 00 0A 00 16 00 14 00 17 00 18 00 19 ...C............
0040: 00 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 16 00 0B ................
0050: 00 02 01 00 00 0D 00 16 00 14 06 03 06 01 05 03 ................
0060: 05 01 04 03 04 01 04 02 02 03 02 01 02 02 00 17 ................
0070: 00 00 FF 01 00 01 00 .......
[Raw read]: length = 5
0000: 15 03 01 00 02 .....
[Raw read]: length = 2
0000: 02 28 .(
pool-1-thread-1, READ: TLSv1 Alert, length = 2
pool-1-thread-1, RECV TLSv1.2 ALERT: fatal, handshake_failure
pool-1-thread-1, called closeSocket()
pool-1-thread-1, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1991)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1098)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1344)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1371)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1355)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106)
Я нашел много статейно не могу найти причину, я думаю, что проблема может быть найдена, следуя двум ошибкам.
pool-1-thread-1, READ: TLSv1 Alert, длина = 2
pool-1-thread-1, RECV TLSv1.2 ALERT: фатально, handshake_failure
Почему READ - TLSv1, RECV - TLSv1.2 ??