mirror of https://github.com/M66B/FairEmail.git
Prevent double including own S/MIME cert
This commit is contained in:
parent
e74bc8772a
commit
2ac8840458
|
@ -2704,8 +2704,8 @@ public class FragmentCompose extends FragmentBase {
|
|||
addresses.addAll(Arrays.asList(draft.bcc));
|
||||
|
||||
List<X509Certificate> certs = new ArrayList<>();
|
||||
certs.add(chain[0]); // Allow sender to decrypt own message
|
||||
|
||||
boolean own = true;
|
||||
for (Address address : addresses) {
|
||||
boolean found = false;
|
||||
Throwable cex = null;
|
||||
|
@ -2718,6 +2718,8 @@ public class FragmentCompose extends FragmentBase {
|
|||
cert.checkValidity();
|
||||
certs.add(cert);
|
||||
found = true;
|
||||
if (cert.equals(chain[0]))
|
||||
own = false;
|
||||
} catch (CertificateException ex) {
|
||||
Log.w(ex);
|
||||
cex = ex;
|
||||
|
@ -2733,6 +2735,10 @@ public class FragmentCompose extends FragmentBase {
|
|||
context.getString(R.string.title_certificate_invalid, email), cex);
|
||||
}
|
||||
|
||||
// Allow sender to decrypt own message
|
||||
if (own)
|
||||
certs.add(chain[0]);
|
||||
|
||||
// Build signature
|
||||
BodyPart bpSignature = new MimeBodyPart();
|
||||
bpSignature.setFileName("smime.p7s");
|
||||
|
|
Loading…
Reference in New Issue