mirror of https://github.com/M66B/FairEmail.git
Improved cert error handling
This commit is contained in:
parent
bd0b12748c
commit
7401da8503
|
@ -81,6 +81,7 @@ import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
import java.security.cert.CertificateException;
|
||||||
import java.security.cert.CertificateFactory;
|
import java.security.cert.CertificateFactory;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.security.spec.KeySpec;
|
import java.security.spec.KeySpec;
|
||||||
|
@ -1043,7 +1044,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
|
|
||||||
String fingerprint = EntityCertificate.getFingerprint(cert);
|
String fingerprint = EntityCertificate.getFingerprint(cert);
|
||||||
List<String> emails = EntityCertificate.getAltSubjectName(cert);
|
List<String> emails = EntityCertificate.getAltSubjectName(cert);
|
||||||
String subject = EntityCertificate.getSubject(cert);
|
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
for (String email : emails) {
|
for (String email : emails) {
|
||||||
|
@ -1061,7 +1061,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
if (ex instanceof IllegalArgumentException)
|
if (ex instanceof IllegalArgumentException)
|
||||||
ToastEx.makeText(ActivitySetup.this, ex.getMessage(), Toast.LENGTH_LONG).show();
|
ToastEx.makeText(ActivitySetup.this, ex.getMessage(), Toast.LENGTH_LONG).show();
|
||||||
else if (ex instanceof IllegalStateException)
|
else if (ex instanceof IllegalStateException || ex instanceof CertificateException)
|
||||||
ToastEx.makeText(ActivitySetup.this, R.string.title_invalid_key, Toast.LENGTH_LONG).show();
|
ToastEx.makeText(ActivitySetup.this, R.string.title_invalid_key, Toast.LENGTH_LONG).show();
|
||||||
else
|
else
|
||||||
Log.unexpectedError(getSupportFragmentManager(), ex);
|
Log.unexpectedError(getSupportFragmentManager(), ex);
|
||||||
|
|
Loading…
Reference in New Issue