mirror of https://github.com/M66B/FairEmail.git
Improved PEM/DER selection
This commit is contained in:
parent
bdb7ca1ba0
commit
651802150d
|
@ -554,18 +554,18 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
|
|
||||||
boolean der = false;
|
boolean der = false;
|
||||||
String extension = Helper.getExtension(uri.getLastPathSegment());
|
String extension = Helper.getExtension(uri.getLastPathSegment());
|
||||||
Log.i("Extension=" + extension);
|
|
||||||
if (!"pem".equalsIgnoreCase(extension))
|
|
||||||
try {
|
|
||||||
DocumentFile dfile = DocumentFile.fromSingleUri(context, uri);
|
DocumentFile dfile = DocumentFile.fromSingleUri(context, uri);
|
||||||
String type = dfile.getType();
|
String type = (dfile == null ? null : dfile.getType());
|
||||||
Log.i("Type=" + type);
|
// https://pki-tutorial.readthedocs.io/en/latest/mime.html
|
||||||
if ("application/octet-stream".equals(type))
|
if (!"pem".equalsIgnoreCase(extension) &&
|
||||||
|
!"application/x-pem-file".equals(type))
|
||||||
|
try {
|
||||||
|
if (type != null && type.startsWith("application/"))
|
||||||
der = true;
|
der = true;
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.w(ex);
|
Log.w(ex);
|
||||||
}
|
}
|
||||||
Log.i("DER=" + der);
|
Log.i("Extension=" + extension + "type=" + type + " DER=" + der);
|
||||||
|
|
||||||
X509Certificate cert;
|
X509Certificate cert;
|
||||||
CertificateFactory fact = CertificateFactory.getInstance("X.509");
|
CertificateFactory fact = CertificateFactory.getInstance("X.509");
|
||||||
|
@ -603,6 +603,11 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onExecuted(Bundle args, Void data) {
|
||||||
|
ToastEx.makeText(ActivitySetup.this, R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
// DecoderException: unable to decode base64 string: invalid characters encountered in base64 data
|
// DecoderException: unable to decode base64 string: invalid characters encountered in base64 data
|
||||||
|
|
Loading…
Reference in New Issue