Disable SSL as a protocol in HttpsURLConnection

后端 未结 6 1754
眼角桃花
眼角桃花 2020-12-02 15:14

Due to the POODLE vulnerability, my server, hosted in Amazon AWS does no longer support SSLv3.

As a result, the first HTTPS connection my Android app does against th

6条回答
  •  不知归路
    2020-12-02 15:37

    I took @GaRRaPeTa's answer and bundled it into a dead simple method call. You can use the NetCipher library to get a modern TLS config when using Android's HttpsURLConnection. NetCipher configures the `HttpsURLConnection instance to use the best supported TLS version, removes SSLv3 support, and configures the best suite of ciphers for that TLS version. First, add it to your build.gradle:

    compile 'info.guardianproject.netcipher:netcipher:1.2'
    

    Or you can download the netcipher-1.2.jar and include it directly in your app. Then instead of calling:

    HttpURLConnection connection = (HttpURLConnection) sourceUrl.openConnection();
    

    Call this:

    HttpsURLConnection connection = NetCipher.getHttpsURLConnection(sourceUrl);
    

提交回复
热议问题