简体   繁体   English

java ssl handshake_failure问题

[英]java ssl handshake_failure issue

I'm trying to send a request to one of our server url,but whenever i try to connect I get this expection 我正在尝试向我们的服务器网址之一发送请求,但是每当我尝试连接时,我都会得到这种期望

java.net.ConnectException: Received fatal alert: handshake_failure

This the certificate details i got from the browser when visiting the website. 访问网站时从浏览器获得的证书详细信息。

Common Name (CN)    Go Daddy Secure Certificate Authority - G2
Organisation (O)    GoDaddy.com, Inc.
Organisational Unit (OU)    http://certs.godaddy.com/repository/

I checked for the same details in cacerts in my java directory 我在java目录中的cacerts中检查了相同的详细信息

keytool -list -keystore /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.101-3.b13.24.amzn1.x86_64/jre/lib/security/cacerts | grep godaddy

godaddyclass2ca, 23 Sep, 2016, trustedCertEntry, 
godaddyrootcertificateauthority-g2, 23 Sep, 2016, trustedCertEntry,

This is the installed java version: 这是已安装的Java版本:

openjdk version "1.8.0_101"
OpenJDK Runtime Environment (build 1.8.0_101-b13)
OpenJDK 64-Bit Server VM (build 25.101-b13, mixed mode)

I even downloaded the certificate from the browser and imported it into cacerts 我什至从浏览器下载了证书并将其导入到cacerts

keytool -import -keystore cacerts -file test.cer

Please help me to debug it. 请帮助我调试它。

You need to install JCE extension for you JVM. 您需要为JVM安装JCE扩展。 Basicly this problem is due to the mismatch cipher between your local JAVA and the https site. 基本上,此问题是由于本地JAVA与https站点之间的密码不匹配所致。

Use https://www.ssllabs.com/ to check if your REST API supports java, check this image example 使用https://www.ssllabs.com/检查您的REST API是否支持Java, 请检查此图像示例

If it shows like this, you can download the files from http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html . 如果显示如下,则可以从http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html下载文件。 Once done, replace the two JARs (local_policy.jar, US_export_policy.jar) under your JRE's lib/security directory with the ones from the downloaded package. 完成后,将JRE的lib / security目录下的两个JAR(local_policy.jar,US_export_policy.jar)替换为下载包中的两个JAR。

If not, please provide more detail information so we can check in detail. 如果没有,请提供更多详细信息,以便我们进行详细检查。

Check the solution here i just tired How to debug the ssl connection error , it works for me and save my day! 在这里检查解决方案我很累如何调试ssl连接错误 ,它对我有用 ,并节省了我的时间!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM