JDK升级导致TLS证书认证失败

本文介绍了如何解决因证书长度不匹配导致的TLS证书认证错误。具体表现为JDK7默认限制RSA最低长度为1024位,而客户端使用了512位的证书。文章提供了详细的解决步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用证书进行TLS证书认证报以下错误:

Caused by: javax.net.ssl.SSLHandshakeExceptionjava.security.cert.CertificateException: Certificates does not conform to algorithm constraints 
    at sun.security.ssl.Alerts.getSSLException(Unknown Source) 
    at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) 
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source) 
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source) 
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) 
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)

原因:JDK7版本已经默认限制RSA最低长度为1024,而客户端使用了RSA为512位的证书导致服务器无法正常调用库进行解密。

措施:

修改文件$\jdk\jre\lib\security\java.security

将jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024修改为jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 512或者直接删除该限制

相关链接:

http://windowsexplored.com/2013/09/04/java-7-troubleshooting-disabled-support-for-md2/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值