mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-31 14:17:03 +02:00
Show certificate information / quick setup
This commit is contained in:
@@ -484,7 +484,7 @@ public class EmailService implements AutoCloseable {
|
||||
Throwable ce = ex;
|
||||
while (ce != null) {
|
||||
if (factory != null && ce instanceof CertificateException)
|
||||
throw new UntrustedException(factory.certificate, ex);
|
||||
throw new UntrustedException(ex, factory.certificate);
|
||||
if (ce instanceof IOException)
|
||||
ioError = true;
|
||||
ce = ce.getCause();
|
||||
@@ -1037,10 +1037,10 @@ public class EmailService implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
class UntrustedException extends MessagingException {
|
||||
static class UntrustedException extends MessagingException {
|
||||
private X509Certificate certificate;
|
||||
|
||||
UntrustedException(@NonNull X509Certificate certificate, @NonNull Exception cause) {
|
||||
UntrustedException(@NonNull Exception cause, @NonNull X509Certificate certificate) {
|
||||
super("Untrusted", cause);
|
||||
this.certificate = certificate;
|
||||
}
|
||||
@@ -1049,23 +1049,10 @@ public class EmailService implements AutoCloseable {
|
||||
return certificate;
|
||||
}
|
||||
|
||||
String getFingerprint() {
|
||||
try {
|
||||
if (certificate == null)
|
||||
return null;
|
||||
String keyId = EntityCertificate.getKeyId(certificate);
|
||||
String fingerPrint = EntityCertificate.getFingerprintSha1(certificate);
|
||||
return fingerPrint + (keyId == null ? "" : "/" + keyId);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public synchronized String toString() {
|
||||
return getCause().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user