使用证书进行TLS证书认证报以下错误:
Caused by: javax.net.ssl.SSLHandshakeException: java.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/