简体   繁体   English

Android客户端未使用自签名证书连接到Tomcat

[英]Android client doesn't connect to Tomcat with a self-signed certificate

a colleague had a problem with the connection to an SSL Server using his own developed application. 一位同事使用自己开发的应用程序与SSL服务器的连接出现问题。 I configured my Tomcat machine with a self-signed certificate (.pem) and a connection via browser works fine. 我使用自签名证书(.pem)配置我的Tomcat机器,并通过浏览器连接正常。 Hi tried to add mine certificate to his "application resources" but doesn't works. 嗨试图将我的证书添加到他的“应用程序资源”但不起作用。 Can anyone helps me and my colleague? 任何人都可以帮助我和我的同事吗? Do I modify any setting on my server.xml or web.xml? 我是否修改了server.xml或web.xml上的任何设置? Thanks. 谢谢。

The Android application needs to be slightly modified in order to accept self-signed certificates. 需要稍微修改Android应用程序才能接受自签名证书。 You have two options at this point, either: 此时您有两种选择:

  1. Trust all SSL connections (within the Android app) 信任所有 SSL连接 (在Android应用中)
  2. Create your own TrustManager which also includes the specific server certificate (along with the defaults, if necessary). 创建您自己的TrustManager ,其中还包括特定的服务器证书(如果需要,还包括默认值)。 Here's one example. 这是一个例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM