相关疑难解决方法(0)

116
推荐指数
13
解决办法
22万
查看次数

忽略Apache HttpClient 4.3中的SSL证书

如何忽略Apache HttpClient 4.3的 SSL证书(全部信任)?

我在SO上找到的所有答案都会处理以前的版本,并且API已更改.

有关:

编辑:

  • 它仅用于测试目的.孩子们,不要在家里(或在生产中)尝试

java ssl apache-httpcomponents

97
推荐指数
8
解决办法
16万
查看次数

如何使用Spring RestTemplate禁用SSL证书检查?

我正在尝试编写集成测试,我们的测试使用Simple启动嵌入式HTTPS服务器.我创建了一个自签名证书,keytool并且能够使用浏览器访问服务器(特别是Chrome,我收到有关自签名证书的警告).

但是,当我尝试使用Spring RestTemplate进行连接时,我得到一个ResourceAccessException:

org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://localhost:8088":sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is 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
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:557)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:502)
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:444)
    at net.initech.DummySslServer.shouldConnect(DummySslServer.java:119)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) …
Run Code Online (Sandbox Code Playgroud)

java spring self-signed resttemplate

44
推荐指数
5
解决办法
8万
查看次数

使用Spring RestTemplate访问Https Rest服务

任何人都可以使用Spring rest模板为我提供代码示例来访问使用https保护的休息服务URL.

我有证书,用户名和密码.基本身份验证在服务器端使用,我想创建一个客户端,可以使用提供的证书,用户名和密码(如果需要)连接到该服务器.

rest https spring certificate resttemplate

42
推荐指数
3
解决办法
8万
查看次数