简体   繁体   English

如何忽略 SSL 证书 Java

[英]How to ignore SSL Certificate Java

I keep getting this exception "javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names matching IP address xxx.xxx.xx.xxx found" on a http get request.我在 http get 请求中不断收到此异常“javax.net.ssl.SSLHandshakeException:java.security.cert.CertificateException:找不到与 IP 地址 xxx.xxx.xx.xxx 匹配的主题替代名称”。 I've tried pretty much everything already.我已经尝试了几乎所有的东西。 Is there a JVM argument that i can use to ignore SSL certificates?是否有可用于忽略 SSL 证书的 JVM 参数?

These are the VM arguments running on my JBOSS.这些是在我的 JBOSS 上运行的 VM 参数。

"-Dprogram.name=JBossTools: Red Hat JBoss EAP 6.1+" -server -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 "-Dprogram.name=JBossTools: Red Hat JBoss EAP 6.1+" -server -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dsun.rmi。 dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000

Have you tried to use this class ?你试过使用这个类吗?

Add it to your project and then make a static call.将其添加到您的项目中,然后进行静态调用。

 static {
        SSLUtilities.trustAllHostnames();
        SSLUtilities.trustAllHttpsCertificates();
    }

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

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