mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-28 02:37:16 +00:00
DANE: improved error handling
This commit is contained in:
parent
1e69eac4d5
commit
c101e67900
1 changed files with 15 additions and 7 deletions
|
@ -354,14 +354,22 @@ public class DnsHelper {
|
|||
public void close() throws SecurityException {
|
||||
}
|
||||
};
|
||||
|
||||
String clazz = DaneVerifier.class.getName();
|
||||
Logger.getLogger(clazz).addHandler(handler);
|
||||
Log.w("DANE verify " + server + ":" + port);
|
||||
boolean verified = new DaneVerifier().verifyCertificateChain(chain, server, port);
|
||||
Log.w("DANE verified=" + verified + " " + server + ":" + port);
|
||||
Logger.getLogger(clazz).removeHandler(handler);
|
||||
if (!verified)
|
||||
throw new CertificateException("DANE missing or invalid");
|
||||
try {
|
||||
Logger.getLogger(clazz).addHandler(handler);
|
||||
Log.w("DANE verify " + server + ":" + port);
|
||||
boolean verified = new DaneVerifier().verifyCertificateChain(chain, server, port);
|
||||
Log.w("DANE verified=" + verified + " " + server + ":" + port);
|
||||
if (!verified)
|
||||
throw new CertificateException("DANE missing or invalid");
|
||||
} catch (CertificateException ex) {
|
||||
throw ex;
|
||||
} catch (Throwable ex) {
|
||||
throw new CertificateException("DANE error", ex);
|
||||
} finally {
|
||||
Logger.getLogger(clazz).removeHandler(handler);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> getDnsServers(Context context) {
|
||||
|
|
Loading…
Reference in a new issue