Improved S/MIME error message

This commit is contained in:
M66B 2020-05-26 10:29:53 +02:00
parent 1fe1ef6407
commit c7f5f4d3b8
1 changed files with 8 additions and 0 deletions

View File

@ -5500,10 +5500,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
// Check signature
boolean matching = false;
Store store = signedData.getCertificates();
SignerInformationStore signerInfos = signedData.getSignerInfos();
for (SignerInformation signer : signerInfos.getSigners()) {
for (Object match : store.getMatches(signer.getSID())) {
matching = true;
X509CertificateHolder certHolder = (X509CertificateHolder) match;
X509Certificate cert = new JcaX509CertificateConverter()
.getCertificate(certHolder);
@ -5654,6 +5656,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
break;
}
if (result == null)
args.putString("reason", matching
? "Signature could not be verified"
: "Certificates and signatures do not match");
if (is != null)
decodeMessage(context, is, message, args);
} else {