-->

Android SSL - SNI support

2020-01-24 09:45发布

问题:

I would like to know about the support for the SSL/TLS Server Name Indication (SNI) extension in the Android SDK.

回答1:

As far as I know, there is a partial support in Android SDK. The current situation is the following:

  1. Since the Gingerbread release TLS connection with the HttpsURLConnection API supports SNI.
  2. Apache HTTP client library shipped with Android does not support SNI
  3. The Android web browser does not support SNI neither (since using the Apache HTTP client API)

There is an opened ticket regarding this issue in the Android bug tracker.

It is also possible to test the SNI support by making a connection to this URL: https://sni.velox.ch/



回答2:

Fortunately, HttpsURLConnection supports SNI since Android 2.3. One workaround if you need to support Android 2.2 (and older) is to set up an alternative virtual host on a unique port so that it's unambiguous which server certificate to return.

Please check this link for more information. Hope this will help future users.

Just for information

Newer versions of SSL, specifically TLSv.1.0 and later, support Server Name Indication (SNI), which allows the SSL client to specify the intended hostname to the server so the proper certificate can be returned.



标签: android ssl sni