mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-29 11:15:51 +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 {
|
public void close() throws SecurityException {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
String clazz = DaneVerifier.class.getName();
|
String clazz = DaneVerifier.class.getName();
|
||||||
|
try {
|
||||||
Logger.getLogger(clazz).addHandler(handler);
|
Logger.getLogger(clazz).addHandler(handler);
|
||||||
Log.w("DANE verify " + server + ":" + port);
|
Log.w("DANE verify " + server + ":" + port);
|
||||||
boolean verified = new DaneVerifier().verifyCertificateChain(chain, server, port);
|
boolean verified = new DaneVerifier().verifyCertificateChain(chain, server, port);
|
||||||
Log.w("DANE verified=" + verified + " " + server + ":" + port);
|
Log.w("DANE verified=" + verified + " " + server + ":" + port);
|
||||||
Logger.getLogger(clazz).removeHandler(handler);
|
|
||||||
if (!verified)
|
if (!verified)
|
||||||
throw new CertificateException("DANE missing or invalid");
|
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) {
|
private static List<String> getDnsServers(Context context) {
|
||||||
|
|
Loading…
Reference in a new issue