尝试将请求发布到http服务器时,我收到以下异常:
这是我使用的代码
URL url = new URL(
"https://www.abc.com");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
// wr.writeBytes(params);
wr.flush();
wr.close();
BufferedReader br = new BufferedReader(new InputStreamReader(
conn.getInputStream()));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
Run Code Online (Sandbox Code Playgroud)
这是一个例外:
Exception in thread "main" 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 com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1731)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:241)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:235)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1206)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:136)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
at …
Run Code Online (Sandbox Code Playgroud) 我正在使用Jersey Client库对运行在jboss上的休息服务运行测试.我使用自签名证书在服务器上运行https(在localhost上运行).
但是每当我使用https url运行测试时,我都会收到以下错误:
com.sun.jersey.api.client.ClientHandlerException: 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 com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:131)
at com.sun.jersey.api.client.Client.handle(Client.java:629)
at com.sun.jersey.oauth.client.OAuthClientFilter.handle(OAuthClientFilter.java:137)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:601)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:459)
at test.helper.Helper.sendSignedRequest(Helper.java:174)
... And so on
Run Code Online (Sandbox Code Playgroud)
我知道这是因为我的自签名证书不在java密钥库中.我有什么方法可以Client
不检查ssl证书的有效性,并且无论如何都使用它?
此代码将仅针对测试服务器运行,因此我不想在每次设置新测试服务器时都不必添加新的可信证书.
这是拨打电话的代码:
OAuthParameters params = new OAuthParameters();
// baseline OAuth parameters for access to resource
params.signatureMethod(props.getProperty("signature_method"));
params.consumerKey(props.getProperty("consumer_key"));
params.setToken(props.getProperty("token"));
params.setVersion("1.0");
params.nonce();
// OAuth secrets to access resource
OAuthSecrets secrets = new OAuthSecrets();
secrets.consumerSecret(props.getProperty("consumer_secret"));
secrets.setTokenSecret(props.getProperty("token_secret"));
// Jersey client to make …
Run Code Online (Sandbox Code Playgroud) 我正在使用请求与django应用程序通信但是
当我尝试
requests.get('https://mysite.com', verify=True)
Run Code Online (Sandbox Code Playgroud)
我收到错误:
主机名'mysite.com'与'*.myhost.com','myhost.com'不匹配
但是,当我查看浏览器或http://www.digicert.com/help/时,证书看起来很精致和花花公子.
我的主持人建议缺少SNI支持请求(Github似乎确认https://github.com/kennethreitz/requests/issues/749).有没有人找到使用请求的解决方法?
我想使用Charles Web代理在Windows中使用Android模拟器.我已经成功设置了查尔斯,并使用命令行启动了模拟器:
emulator -http-proxy 127.0.0.1:8888 @NexusOne
Run Code Online (Sandbox Code Playgroud)
我可以看到来自Charles的Android模拟器的流量,但问题是我正在开发使用SSL的实时API,我不知道如何配置Charles让我玩发送的数据和接收.我知道在Charles中设置SSL的两个方面(代理 - >代理设置 - > SSL和代理 - >客户端SSL证书)但我找不到任何可以让我做我想做的事情的体面文档.有没有人经历过Charles或者一般的证书,他们可以解释如何实现这一目标.也许证书的入门书也会很好,因为我似乎缺乏知道这为何如此困难的原因.
我正在尝试为postgreSQL服务器配置ssl证书.我在数据目录中创建了证书文件(server.crt)和密钥(server.key),并将参数SSL更新为"on"以启用安全连接.
我只想要在客户端使用服务器证书对服务器进行身份验证,而不要求服务器端客户端的真实性.我使用psql作为客户端来连接和执行命令.
我正在使用PostgreSQL 8.4和Linux.我尝试使用以下命令连接到启用了ssl的服务器
psql "postgresql://localhost:2345/postgres?sslmode=require"
Run Code Online (Sandbox Code Playgroud)
但我得到了
psql: invalid connection option "postgresql://localhost:2345/postgres?sslmode"
Run Code Online (Sandbox Code Playgroud)
这里有什么问题?我尝试连接到服务器的方式是否启用了ssl模式是正确的?是否可以仅验证服务器而不是客户端?
请帮帮我.
SSL实验室分析:https://www.ssllabs.com/ssltest/analyze.html? d = amz2btc.com
我的桌面浏览器都打开了.移动Firefox打开这个很好.只有当我尝试使用移动Chrome时才会出现错误: err_cert_authority_invalid
我对SSL知之甚少,所以我无法理解SSL报告或为什么会出现这个错误.如果有人能够ELI5,那将是理想的.:)
我使用下面的openssl命令将我的公钥存储到.pem文件中.
openssl> x509 -in E:/mycert.pem -pubkey -out E:/mypubkey.pem
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用此命令时,它将整个证书信息存储在mypubkey.pem文件中.
我已经看到我可以使用保存我的公钥
openssl> x509 -pubkey -noout -in cert.pem > pubkey.pem
Run Code Online (Sandbox Code Playgroud)
但这是一个错误.我不能使用">"运算符.
尝试通过控制台发送电子邮件时,我收到此错误:
OpenSSL::SSL::SSLError: hostname was not match with the server certificate
Run Code Online (Sandbox Code Playgroud)
问题是我真的不太了解证书等,或者真的如何开始对此进行故障排除,我试着做一些调查,openssl
这里是返回的证书.
我不知道它是在服务器上运行的Postfix有问题,还是我的rails应用程序,任何帮助或线索都非常感谢.
~% openssl s_client -connect mail.myhostname.com:25 -starttls smtp
CONNECTED(00000003)
depth=0 /CN=myhostname
verify error:num=18:self signed certificate
verify return:1
depth=0 /CN=myhostname
verify return:1
---
Certificate chain
0 s:/CN=myhostname
i:/CN=myhostname
---
Server certificate
-----BEGIN CERTIFICATE-----
[...redacted...]
-----END CERTIFICATE-----
subject=/CN=myhostname
issuer=/CN=myhostname
---
No client certificate CA names sent
---
SSL handshake has read 1203 bytes and written 360 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 1024 bit …
Run Code Online (Sandbox Code Playgroud) 我在两台不同的机器上有两个基于Spring的Web应用程序A和B.
我想从Web应用程序A到Web应用程序B进行https调用,但是我在机器B中使用自签名证书.因此我的HTTPS请求失败.
如何在Spring中使用RestTemplate时禁用https证书验证?我想禁用验证,因为Web应用A和B都在内部网络中,但数据传输必须通过HTTPS进行
ssl-certificate ×10
ssl ×7
certificate ×2
java ×2
openssl ×2
android ×1
https ×1
jersey ×1
pem ×1
postgresql ×1
python ×1
resttemplate ×1
sni ×1
spring ×1
validation ×1
webproxy ×1