diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 6c206ea10a..142569dc2d 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -10479,6 +10479,44 @@ public class FragmentMessages extends FragmentBase JceKeyTransRecipient recipient = new JceKeyTransEnvelopedRecipient(privkey); Collection recipients = envelopedData.getRecipientInfos().getRecipients(); // KeyTransRecipientInformation + EntityLog.log(context, "s/mime private key" + + " algo=" + privkey.getAlgorithm() + + " serial=" + chain[0].getSerialNumber() + + " class=" + recipient.getClass()); + for (RecipientInformation recipientInfo : recipients) { + String algo; + try { + DefaultAlgorithmNameFinder af = new DefaultAlgorithmNameFinder(); + algo = af.getAlgorithmName(recipientInfo.getKeyEncryptionAlgorithm()); + } catch (Throwable ex) { + Log.e(ex); + algo = recipientInfo.getKeyEncryptionAlgOID(); + } + String serial; + try { + PKIXRecipientId recipientId = (PKIXRecipientId) recipientInfo.getRID(); + serial = recipientId.getSerialNumber().toString(); + } catch (Throwable ex) { + serial = null; + } + EntityLog.log(context, "s/mime recipient" + + " algo=" + algo + + " serial=" + serial + + " class=" + recipientInfo.getClass()); + } + + String malgo; + try { + DefaultAlgorithmNameFinder af = new DefaultAlgorithmNameFinder(); + malgo = af.getAlgorithmName(envelopedData.getContentEncryptionAlgorithm()); + } catch (Throwable ex) { + Log.e(ex); + malgo = envelopedData.getEncryptionAlgOID(); + } + EntityLog.log(context, "s/mime message" + + " algo=" + malgo + + " class=" + envelopedData.getClass()); + // Find recipient if (count < 0) { BigInteger serialno = chain[0].getSerialNumber(); @@ -10490,17 +10528,8 @@ public class FragmentMessages extends FragmentBase InputStream is = recipientInfo.getContentStream(recipient).getContentStream(); decodeMessage(context, is, message, args); decoded = true; - - String algo; - try { - DefaultAlgorithmNameFinder af = new DefaultAlgorithmNameFinder(); - algo = af.getAlgorithmName(envelopedData.getContentEncryptionAlgorithm()); - } catch (Throwable ex) { - Log.e(ex); - algo = envelopedData.getEncryptionAlgOID(); - } - Log.i("Encryption algo=" + algo); - args.putString("algo", algo); + Log.i("Encryption algo=" + malgo); + args.putString("algo", malgo); } catch (CMSException ex) { Log.w(ex); last = ex;