Show certificate errors

pull/177/head
M66B 5 years ago
parent 06998e5d6d
commit 179ea5185c

@ -657,6 +657,13 @@ To allow different private keys for the same email address, FairEmail will alway
Public keys are stored by FairEmail and can be imported when verifying a signature for the first time or via the privacy settings (PEM or DER format).
FairEmail verifies both the signature and the complete certificate chain.
Common errors:
* *No certificate found matching targetContraints*: this likely means you are using an old version of FairEmail
* *unable to find valid certification path to requested target*: basically this means one or more intermediate or root certificates were not found
The use of expired keys, inline encrypted/signed messages and hardware security tokens is not supported.
How to extract a public key from a S/MIME certificate:

@ -5468,6 +5468,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
args.putBoolean("valid", valid);
} catch (Throwable ex) {
Log.w(ex);
args.putString("reason", ex.getMessage());
ArrayList<String> trace = new ArrayList<>();
for (X509Certificate c : certs) {
@ -5630,6 +5631,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
Date time = (Date) args.getSerializable("time");
boolean known = args.getBoolean("known");
boolean valid = args.getBoolean("valid");
String reason = args.getString("reason");
final ArrayList<String> trace = args.getStringArrayList("trace");
EntityCertificate record = EntityCertificate.from(cert, null);
@ -5650,6 +5652,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
LayoutInflater inflator = LayoutInflater.from(getContext());
View dview = inflator.inflate(R.layout.dialog_certificate, null);
TextView tvCertificateInvalid = dview.findViewById(R.id.tvCertificateInvalid);
TextView tvCertificateReason = dview.findViewById(R.id.tvCertificateReason);
TextView tvSender = dview.findViewById(R.id.tvSender);
TextView tvEmail = dview.findViewById(R.id.tvEmail);
TextView tvEmailInvalid = dview.findViewById(R.id.tvEmailInvalid);
@ -5659,6 +5662,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
TextView tvExpired = dview.findViewById(R.id.tvExpired);
tvCertificateInvalid.setVisibility(valid ? View.GONE : View.VISIBLE);
tvCertificateReason.setText(reason);
tvCertificateReason.setVisibility(reason == null ? View.GONE : View.VISIBLE);
tvSender.setText(sender);
tvEmail.setText(TextUtils.join(",", emails));
tvEmailInvalid.setVisibility(match ? View.GONE : View.VISIBLE);
@ -5688,7 +5693,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
.setView(dview)
.setNegativeButton(android.R.string.cancel, null);
.setNegativeButton(android.R.string.cancel, null)
.setNeutralButton(R.string.title_info, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Helper.viewFAQ(getContext(), 12);
}
});
if (!TextUtils.isEmpty(sender) && !known && emails.size() > 0)
builder.setPositiveButton(R.string.title_signature_store, new DialogInterface.OnClickListener() {

@ -29,6 +29,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCertificateReason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_signature_sender"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCertificateInvalid" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSenderTitle"
android:layout_width="wrap_content"
@ -37,7 +46,7 @@
android:text="@string/title_signature_sender"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCertificateInvalid" />
app:layout_constraintTop_toBottomOf="@id/tvCertificateReason" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSender"

Loading…
Cancel
Save