首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >收到致命警报:通过SSLHandshakeException的handshake_failure

收到致命警报:通过SSLHandshakeException的handshake_failure
EN

Stack Overflow用户
提问于 2011-06-15 14:23:25
回答 13查看 656.3K关注 0票数 152

我有一个授权的SSL连接问题。我已经创建了Struts Action,用客户端授权的SSL证书连接到外部服务器。在我的操作中,我试图将一些数据发送到银行服务器,但没有任何运气,因为我从服务器得到了以下错误:

error: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure

我的Action类中将数据发送到服务器的方法

//Getting external IP from host
    URL whatismyip = new URL("http://automation.whatismyip.com/n09230945.asp");
    BufferedReader inIP = new BufferedReader(new InputStreamReader(whatismyip.openStream()));

    String IPStr = inIP.readLine(); //IP as a String

    Merchant merchant;

    System.out.println("amount: " + amount + ", currency: " + currency + ", clientIp: " + IPStr + ", description: " + description);

    try {

        merchant = new Merchant(context.getRealPath("/") + "merchant.properties");

    } catch (ConfigurationException e) {

        Logger.getLogger(HomeAction.class.getName()).log(Level.INFO, "message", e);
        System.err.println("error: " + e.getMessage());
        return ERROR;
    }

    String result = merchant.sendTransData(amount, currency, IPStr, description);

    System.out.println("result: " + result);

    return SUCCESS;

我的merchant.properties文件:

bank.server.url=https://-servernameandport-/
https.cipher=-cipher-

keystore.file=-key-.jks
keystore.type=JKS
keystore.password=-password-
ecomm.server.version=2.0

encoding.source=UTF-8
encoding.native=UTF-8

我第一次认为这是一个证书问题,我将它从.pfx转换为.jks,但我有相同的错误,没有更改。

EN

回答 13

Stack Overflow用户

发布于 2016-09-28 23:16:40

握手失败可能是一个有缺陷的TLSv1协议实现。

在我们的例子中,这对java 7很有帮助:

java -Dhttps.protocols=TLSv1.2,TLSv1.1,TLSv1 

jvm将按此顺序进行协商。带有最新更新的服务器将运行1.2,有错误的服务器将运行v1,并且可以与Java7中类似的v1一起工作。

票数 24
EN

Stack Overflow用户

发布于 2016-11-08 09:31:03

安装Java加密扩展(JCE)无限强度(for JDK7 | for JDK8)可能会修复此错误。解压缩该文件,然后按照自述文件进行安装。

票数 21
EN

Stack Overflow用户

发布于 2016-06-17 06:18:09

假设您正在使用正确的SSL/TLS协议,正确配置了您的keyStoretrustStore,并且确认证书本身不存在任何问题,那么您可能需要strengthen your security algorithms

正如在Vineet's answer中提到的,收到此错误的一个可能原因是使用了不兼容的密码套件。通过将JDK文件夹中的local_policyUS_export_policy jars更新为Java Cryptography Extension (JCE)中提供的jars,我能够成功地完成握手。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6353849

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档