无法对HTTPS已损坏的页面发出REST请求
我正在使用Java中的Restasured尝试向网页发出get请求,但由于SSL问题,我没有成功。许多搜索都让我尝试使用“useRelaxedHTTPSValidation()”,但我运气不好 我得到的例外是:无法对HTTPS已损坏的页面发出REST请求,rest,ssl,rest-assured,Rest,Ssl,Rest Assured,我正在使用Java中的Restasured尝试向网页发出get请求,但由于SSL问题,我没有成功。许多搜索都让我尝试使用“useRelaxedHTTPSValidation()”,但我运气不好 我得到的例外是: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificates does not conform to algorithm constraints 以下是我尝试做的基本
javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificates does not conform to algorithm constraints
以下是我尝试做的基本内容:
RestAssured.baseURI = "HTTPSWebsite";
RestAssured.useRelaxedHTTPSValidation();
// RestAssured.useRelaxedHTTPSValidation("TLS"); // Also tried this
given()
.log().all()
.when()
.get()
.then()
.log().all();
如果我在firefox中访问网站,我会看到:
密码错误证书签名算法被禁用
在chrome中,我看到:
站点的证书链存在问题(net::ERR\u CERT\u COMMON\u NAME\u无效)
如果我取出“userelaxetpsvalidation()”
我得到了错误
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
任何建议都很好。因此我无法找到如何直接让该函数工作,但我发现添加以下两行更改了安全设置以允许所有算法。从那时起,一切都起了作用
Security.setProperty("jdk.tls.disabledAlgorithms","");
Security.setProperty("jdk.certpath.disabledAlgorithms","");