Use SSL context with TLS fallback

pull/194/merge
M66B 3 years ago
parent 068e812fd3
commit fc6b36a5e8

@ -963,7 +963,13 @@ public class EmailService implements AutoCloseable {
this.cert_strict = cert_strict; this.cert_strict = cert_strict;
this.trustedFingerprint = fingerprint; 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()); TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null); tmf.init((KeyStore) null);

Loading…
Cancel
Save