使用SSL Android应用(Android application with SSL)

2019-09-23 23:30发布

I know that this particular topic was asked many times, but unfortunately in my case none of them are working. For past few days I was trying to get it to functional state, but I failed every time, so I finally come here to ask.

I have a webservice on server with self-signed certificate. I can access wsdl file if I enter address into browser. Browser just remind me, that there is some issues with cert. and if I hit continue, everything works. Sadly I know very little about SSL, because its first time I made an application with SSL communication. In application I'll only get exception "No peer certificate" or "Trust anchor path not found" depends on type of "solution" I used.

I ran test on sslhopper.com and I get a warning that "The certificate is not trusted in all web browsers. You may need to install an Intermediate/chain certificate to link it to a trusted root certificate." Is this a serious issue in Android development or it could be resolved by some code?

So my question is actually, how can I do in application make "hit the continue button" or anything to make it actually connected to the server. In this case is it problem with certificate itself or am I doing something wrong on the application itself?

Answer 1:

如果你正在尝试做的客户端身份验证,则需要两件事情:

  1. 颁发服务器证书的CA证书
  2. 为您的应用客户端证书。

你必须把信任存储1和2中的密钥库为您的应用程序。 示例代码需要一个PCKS#12密钥库,你有吗? 哪些文件你被赋予了? 在这一点上它可能是很好的阅读JSSE参考,所以你有一个想法,该系统是如何工作的:

http://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html



文章来源: Android application with SSL