File tree Expand file tree Collapse file tree
src/main/java/org/simplejavamail/utils/mail/smime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ public enum SmimeState {
1818 * encrypted.
1919 */
2020 ENCRYPTED ,
21-
21+
22+ /**
23+ * Indicates that the {@link MimePart} or {@link MimeMultipart} is probably S/MIME
24+ * signed (type was multipart/signed, but protocol was missing).
25+ */
26+ PROBABLY_SIGNED ,
27+
2228 /**
2329 * Indicates that the {@link MimePart} or {@link MimeMultipart} is S/MIME
2430 * signed.
Original file line number Diff line number Diff line change @@ -656,6 +656,8 @@ public static SmimeState getStatus(MimePart mimePart) {
656656 private static SmimeState getStatus (ContentType contentType ) {
657657 if (isSmimeSignatureContentType (contentType )) {
658658 return SmimeState .SIGNED ;
659+ } if (isProbablySmimeSignatureContentType (contentType )) {
660+ return SmimeState .PROBABLY_SIGNED ;
659661 } else if (isSignatureSmimeType (contentType )) {
660662 return SmimeState .SIGNED_ENVELOPED ;
661663 } else if (isSmimeEncryptionContenttype (contentType )) {
@@ -672,12 +674,16 @@ private static boolean isSmimeEncryptionContenttype(ContentType contentType) {
672674 }
673675
674676 private static boolean isSmimeSignatureContentType (ContentType contentType ) {
675- String baseContentType = contentType .getBaseType ();
676677 String protocol = contentType .getParameter ("protocol" );
677- return baseContentType .equalsIgnoreCase ("multipart/signed" )
678+ return contentType . getBaseType () .equalsIgnoreCase ("multipart/signed" )
678679 && protocol != null && isSmimeSignatureProtocoll (protocol );
679680 }
680681
682+ private static boolean isProbablySmimeSignatureContentType (ContentType contentType ) {
683+ String protocol = contentType .getParameter ("protocol" );
684+ return contentType .getBaseType ().equalsIgnoreCase ("multipart/signed" ) && protocol == null ;
685+ }
686+
681687 private static boolean isSignatureSmimeType (ContentType contentType ) {
682688 String baseContentType = contentType .getBaseType ();
683689 return baseContentType .equalsIgnoreCase ("application/x-pkcs7-mime" )
You can’t perform that action at this time.
0 commit comments