更新时间:2021-07-24 05:51:32
我是新来的放心,但是像我这样的java SSL问题code> handshake_failure 通常是相同的:
I am new to rest-assured, but the java SSL problems like handshake_failure
are usually the same:
要检测原因,可以设置以下环境变量来详细说明协议详细信息
To detect the cause the following environment variable can be set to verbose the protocol details
-Djavax.net.debug=ssl
针对您在SSL方面的具体问题,请查看放心的ssl文档 https://github.com/rest-assured/rest-assured/wiki/Usage#ssl
For your specific issue with SSL, take a look at rest assured ssl documentation https://github.com/rest-assured/rest-assured/wiki/Usage#ssl
首先你可以尝试禁用通常的https验证
First you can try to disable usual https verification
given().relaxedHTTPSValidation().when().get("https://some_server.com"). ..
如果可行,请使用服务器的证书创建一个JKS信任库
If it works, create a JKS truststore with the certificates of the server
1)从服务器下载它们(点击浏览器绿色锁并下载每个)
2)用keytool创建JKS并导入可信证书。请遵循放心指南中的指南或使用 portecle
3)在JKS中配置信任库
1)Download them from the server (click on browser green lock and download each one) 2) Create the JKS with keytool and import the trusted certificates. Follow the guide in rest-assured guide or use portecle 3) Configure truststore in JKS
given().keystore("/pathToJksInClassPath", <password>). ..
如果您需要客户端身份验证(我认为没有),请查看此帖子如何使用证书进行HTTPS GET调用Rest-Assured java
If you need client authentication ( I think no), check this post How to make HTTPS GET call with certificate in Rest-Assured java
如果这对您没有任何帮助,请不要忘记用
If nothing of this works for you, do not forget todebug the SSL connection with
-Djavax.net.debug=ssl
确保客户端支持您的服务器算法。例如,如果使用Java7,则默认情况下不启用TLS1.2
Ensure that the algorithm of your server is supported by your client. For example if you use Java7, TLS1.2 is not enabled by default