mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
Re-enable TLSv1.1/1.2 support
Was disabled in3fd7470d
. Issue 6238. Related Android change for API 20:1f63d2c223
%5E!/
This commit is contained in:
parent
a10b9ae452
commit
0f6719387c
@ -74,7 +74,7 @@ public class TrustedSocketFactory {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
String[] enabledCiphers = null;
|
String[] enabledCiphers = null;
|
||||||
String[] enabledProtocols = null;
|
String[] supportedProtocols = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS");
|
SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||||
@ -82,7 +82,13 @@ public class TrustedSocketFactory {
|
|||||||
SSLSocketFactory sf = sslContext.getSocketFactory();
|
SSLSocketFactory sf = sslContext.getSocketFactory();
|
||||||
SSLSocket sock = (SSLSocket) sf.createSocket();
|
SSLSocket sock = (SSLSocket) sf.createSocket();
|
||||||
enabledCiphers = sock.getEnabledCipherSuites();
|
enabledCiphers = sock.getEnabledCipherSuites();
|
||||||
enabledProtocols = sock.getEnabledProtocols();
|
|
||||||
|
/*
|
||||||
|
* Retrieve all supported protocols, not just the (default) enabled
|
||||||
|
* ones. TLSv1.1 & TLSv1.2 are supported on API levels 16+, but are
|
||||||
|
* only enabled by default on API levels 20+.
|
||||||
|
*/
|
||||||
|
supportedProtocols = sock.getSupportedProtocols();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Error getting information about available SSL/TLS ciphers and " +
|
Log.e(K9.LOG_TAG, "Error getting information about available SSL/TLS ciphers and " +
|
||||||
"protocols", e);
|
"protocols", e);
|
||||||
@ -91,8 +97,8 @@ public class TrustedSocketFactory {
|
|||||||
ENABLED_CIPHERS = (enabledCiphers == null) ? null :
|
ENABLED_CIPHERS = (enabledCiphers == null) ? null :
|
||||||
reorder(enabledCiphers, ORDERED_KNOWN_CIPHERS, BLACKLISTED_CIPHERS);
|
reorder(enabledCiphers, ORDERED_KNOWN_CIPHERS, BLACKLISTED_CIPHERS);
|
||||||
|
|
||||||
ENABLED_PROTOCOLS = (enabledProtocols == null) ? null :
|
ENABLED_PROTOCOLS = (supportedProtocols == null) ? null :
|
||||||
reorder(enabledProtocols, ORDERED_KNOWN_PROTOCOLS, null);
|
reorder(supportedProtocols, ORDERED_KNOWN_PROTOCOLS, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String[] reorder(String[] enabled, String[] known, String[] blacklisted) {
|
protected static String[] reorder(String[] enabled, String[] known, String[] blacklisted) {
|
||||||
|
Loading…
Reference in New Issue
Block a user