Added max. TLS to provider profiles

This commit is contained in:
M66B
2022-11-15 18:15:53 +01:00
parent b901fde5f2
commit df92814dcb
3 changed files with 24 additions and 2 deletions

View File

@@ -47,6 +47,7 @@ import com.sun.mail.util.SocketConnectException;
import com.sun.mail.util.TraceOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -430,7 +431,18 @@ public class EmailService implements AutoCloseable {
}
}
factory = new SSLSocketFactoryService(host, insecure, ssl_harden, ssl_harden_strict, cert_strict, key, chain, fingerprint);
boolean strict = ssl_harden_strict;
if (provider != null)
try {
EmailProvider p = EmailProvider.getProvider(context, provider);
if ("1.2".equals(p.maxtls)) {
strict = false;
Log.i(p.name + " maxtls=" + p.maxtls);
}
} catch (FileNotFoundException ignored) {
}
factory = new SSLSocketFactoryService(host, insecure, ssl_harden, strict, cert_strict, key, chain, fingerprint);
properties.put("mail." + protocol + ".ssl.socketFactory", factory);
properties.put("mail." + protocol + ".socketFactory.fallback", "false");
properties.put("mail." + protocol + ".ssl.checkserveridentity", "false");