Use SSL context with TLS fallback

This commit is contained in:
M66B
2022-02-22 19:17:20 +01:00
parent 068e812fd3
commit fc6b36a5e8

View File

@@ -963,7 +963,13 @@ public class EmailService implements AutoCloseable {
this.cert_strict = cert_strict;
this.trustedFingerprint = fingerprint;
SSLContext sslContext = SSLContext.getInstance("TLS");
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance("SSL");
}catch (Throwable ex){
Log.e(ex);
sslContext = SSLContext.getInstance("TLS");
}
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null);