Debug: S/MIME algorithms

master
M66B 7 days ago
parent aee6ec14fe
commit e3be7c8922

@ -10479,6 +10479,44 @@ public class FragmentMessages extends FragmentBase
JceKeyTransRecipient recipient = new JceKeyTransEnvelopedRecipient(privkey); JceKeyTransRecipient recipient = new JceKeyTransEnvelopedRecipient(privkey);
Collection<RecipientInformation> recipients = envelopedData.getRecipientInfos().getRecipients(); // KeyTransRecipientInformation Collection<RecipientInformation> 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 // Find recipient
if (count < 0) { if (count < 0) {
BigInteger serialno = chain[0].getSerialNumber(); BigInteger serialno = chain[0].getSerialNumber();
@ -10490,17 +10528,8 @@ public class FragmentMessages extends FragmentBase
InputStream is = recipientInfo.getContentStream(recipient).getContentStream(); InputStream is = recipientInfo.getContentStream(recipient).getContentStream();
decodeMessage(context, is, message, args); decodeMessage(context, is, message, args);
decoded = true; decoded = true;
Log.i("Encryption algo=" + malgo);
String algo; args.putString("algo", malgo);
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);
} catch (CMSException ex) { } catch (CMSException ex) {
Log.w(ex); Log.w(ex);
last = ex; last = ex;

Loading…
Cancel
Save