How can I make Android Volley perform HTTPS request, using a certificate self-signed by an Unknown CA?

前端 未结 4 1427
无人共我
无人共我 2020-12-05 05:37

Before making the question, I found some links, which I checked, one by one, and none of them, gives me a solution:

  • well-kown CA HTTPS request
4条回答
  •  情歌与酒
    2020-12-05 06:16

    I have faced the similar problem in the past and the solution for the same that worked was to install the intermediate certificate authority on the server side.

    What is interesting to note here is that visiting this server in most desktop browsers does not cause an error like a completely unknown CA or self-signed server certificate would cause. This is because most desktop browsers cache trusted intermediate CAs over time. Once a browser has visited and learned about an intermediate CA from one site, it won't need to have the intermediate CA included in the certificate chain the next time.

    Some sites do this intentionally for secondary web servers used to serve resources. For example, they might have their main HTML page served by a server with a full certificate chain, but have servers for resources such as images, CSS, or JavaScript not include the CA, presumably to save bandwidth. Unfortunately, sometimes these servers might be providing a web service you are trying to call from your Android app, which is not as forgiving.

    Configure the server to include the intermediate CA in the server chain. Most CAs provide documentation on how to do this for all common web servers. This is the only approach if you need the site to work with default Android browsers at least through Android 4.2.

    You can follow the steps as mentioned here Missing intermediate certificate authority

    Another example What is an intermediate certificate?

    FYI trust-anchor-not-found-for-android-ssl-connection

    Browsers may accept root certificate authority but Android SDK may not do the same because browsers cache the same. Browsers will cache intermediate certificates, and use them between different sites. Because of that, if you are missing the intermediate certificate, random users will receive a trust error, while others won't. Do intermediate certificates get cached in Firefox?

提交回复
热议问题