Improved S/MIME fallback

pull/194/head
M66B 4 years ago
parent 5f9d059bbc
commit 33ca87240c

@ -2399,16 +2399,25 @@ public class MessageHelper {
part.isMimeType("application/x-pkcs7-mime")) { part.isMimeType("application/x-pkcs7-mime")) {
ContentType ct = new ContentType(part.getContentType()); ContentType ct = new ContentType(part.getContentType());
String smimeType = ct.getParameter("smime-type"); String smimeType = ct.getParameter("smime-type");
if ("enveloped-data".equalsIgnoreCase(smimeType) || if ("enveloped-data".equalsIgnoreCase(smimeType)) {
"smime.p7m".equalsIgnoreCase(ct.getParameter("name"))) {
getMessageParts(part, parts, EntityAttachment.SMIME_MESSAGE); getMessageParts(part, parts, EntityAttachment.SMIME_MESSAGE);
return parts; return parts;
} else if ("signed-data".equalsIgnoreCase(smimeType) || } else if ("signed-data".equalsIgnoreCase(smimeType)) {
"smime.p7s".equalsIgnoreCase(ct.getParameter("name"))) {
getMessageParts(part, parts, EntityAttachment.SMIME_SIGNED_DATA); getMessageParts(part, parts, EntityAttachment.SMIME_SIGNED_DATA);
return parts; return parts;
} else } else {
if (TextUtils.isEmpty(smimeType)) {
String name = ct.getParameter("name");
if ("smime.p7m".equalsIgnoreCase(name)) {
getMessageParts(part, parts, EntityAttachment.SMIME_MESSAGE);
return parts;
} else if ("smime.p7s".equalsIgnoreCase(name)) {
getMessageParts(part, parts, EntityAttachment.SMIME_SIGNED_DATA);
return parts;
}
}
Log.e(ct.toString()); Log.e(ct.toString());
}
} }
} catch (ParseException ex) { } catch (ParseException ex) {
Log.w(ex); Log.w(ex);

Loading…
Cancel
Save