解决 HTTPS 证书失效菜刀连不上

解决 HTTPS 证书失效菜刀连不上

相关信息

Mac 10.14

jdk1.8.0_144

尝试1:

默认在中国蚁剑里面有忽略 https 证书的选项, 测试失败

尝试2:

在 执行 jar 时加入参数-Djsse.enableSNIExtension=false , 忽略证书菜刀测试失败, burpsuite 测试成功

尝试3:

在 执行 jar 时加入参数 -Djdk.tls.client.protocols="TLSv1,TLSv1.1" , 测试失败

报错汇总

报错1: cert has expired

报错2: Certificates does not conform to algorithm constraints

原因:

1

JDK7/8后添加了安全机制,导致这个问题出现

解决办法:

第一步:

更改配置文件$JAVA_HOME/jre/lib/security/java.security

1

2

3

4

5

6

7

8

9

10

11

12

jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024

jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768

改为

jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024

jdk.tls.disabledAlgorithms=SSLv3, RC4, DH keySize < 768

或者置为空

jdk.certpath.disabledAlgorithms=

jdk.tls.disabledAlgorithms=

第二步运行程序:

1

java -Djsse.enableSNIExtension=false -jar xxxx.jar

建议

不要一直把该配置应用到物理机 . 测试完成还原配置 有SSL证书连接更安全

可以尝试还原 java 接口 X509TrustManager //斜眼笑

参考

https://stackoverflow.com/questions/14149545/java-security-cert-certificateexception-certificates-does-not-conform-to-algori

https://blog.csdn.net/shumeng_xiaoyan/article/details/76503601

https://m.2cto.com/kf/201208/151826.html

相关推荐