信任锚找不到为Android SSL连接 [英] Trust Anchor not found for Android SSL Connection

查看:424
本文介绍了信任锚找不到为Android SSL连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连接到运行的GoDaddy的256位SSL证书的IIS6中,而我得到的错误:

  java.security.cert.CertPathValidatorException:找不到证书路径信任锚。
 

在试图确定什么可以引起如此,画坯现在。

下面是我如何连接:

  HttpsURLConnection康恩;
康恩=(HttpsURLConnection)(新的URL(mURL))的openConnection()。
conn.setConnectTimeout(20000);
conn.setDoInput(真正的);
conn.setDoOutput(真正的);
conn.connect();
字符串tempString =的toString(conn.getInputStream());
 

解决方案

@Chrispix的解决方案是很危险的!信任所有证书允许任何人做了中间人攻击!只需发送任何证书给客户端,它会接受它!

添加您证书就像在这篇文章中描述的自定义信任管理器:<一href="http://stackoverflow.com/questions/2642777/trusting-all-certificates-using-httpclient-over-https/6378872#6378872">Trusting使用HttpClient的所有证书通过HTTPS

此外,它是比较复杂的,建立一个自定义证书的安全连接的一点,它会带给你不男人在中间攻击的危险通缉的SSL加密的安全性!

I am trying to connect to an IIS6 box running a godaddy 256bit SSL cert, and I am getting the error :

java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

Been trying to determine what could be causing that, but drawing blanks right now.

Here is how I am connecting :

HttpsURLConnection conn;              
conn = (HttpsURLConnection) (new URL(mURL)).openConnection();
conn.setConnectTimeout(20000);
conn.setDoInput(true);
conn.setDoOutput(true);
conn.connect();
String tempString = toString(conn.getInputStream()); 

解决方案

The solution of @Chrispix is dangerous! Trusting all certificates allows anybody to do a man in the middle attack!!! Just send ANY certificate to the client and it will accept it!!!

Add you certificate to a custom trust manager like described in this post: Trusting all certificates using HttpClient over HTTPS

Also it is a bit more complex to establish a secure connection with a custom certificate, it will bring you the wanted ssl encryption security without the danger of man in the middle attack!

这篇关于信任锚找不到为Android SSL连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆