@@ -99,7 +99,7 @@ private static void updateMailcapCommandMap() {
9999
100100 /**
101101 * Encrypts a MIME message and yields a new S/MIME encrypted MIME message.
102- *
102+ *
103103 * @param session
104104 * The {@link Session} that is used in conjunction with the
105105 * original {@link MimeMessage}.
@@ -131,7 +131,7 @@ public static MimeMessage encrypt(Session session, MimeMessage mimeMessage, X509
131131 /**
132132 * Encrypts a MIME body part and yields a new S/MIME encrypted MIME body
133133 * part.
134- *
134+ *
135135 * @param mimeBodyPart
136136 * The original {@link MimeBodyPart} to be encrypted.
137137 * @param certificate
@@ -184,7 +184,7 @@ private static OutputEncryptor prepareEncryptor() throws CMSException {
184184
185185 /**
186186 * Decrypts an S/MIME encrypted MIME message and yields a new MIME message.
187- *
187+ *
188188 * @param session
189189 * The {@link Session} that is used in conjunction with the
190190 * encrypted {@link MimeMessage}.
@@ -214,7 +214,7 @@ public static MimeMessage decrypt(Session session, MimeMessage mimeMessage, Smim
214214 /**
215215 * Decrypts an S/MIME encrypted MIME body part and yields a new MIME body
216216 * part.
217- *
217+ *
218218 * @param mimeBodyPart
219219 * The encrypted {@link MimeBodyPart} to be decrypted.
220220 * @param smimeKey
@@ -234,7 +234,7 @@ public static MimeBodyPart decrypt(MimeBodyPart mimeBodyPart, SmimeKey smimeKey)
234234 /**
235235 * Decrypts an S/MIME encrypted MIME multipart and yields a new MIME body
236236 * part.
237- *
237+ *
238238 * @param mimeMultipart
239239 * The encrypted {@link MimeMultipart} to be decrypted.
240240 * @param smimeKey
@@ -285,7 +285,7 @@ private static void copyContent(MimeBodyPart fromBodyPart, MimeMessage toMessage
285285
286286 /**
287287 * Signs a MIME body part and yields a new S/MIME signed MIME body part.
288- *
288+ *
289289 * @param mimeBodyPart
290290 * The original {@link MimeBodyPart} to be signed.
291291 * @param smimeKey
@@ -407,7 +407,7 @@ private static MimeBodyPart extractMimeBodyPart(MimeMessage mimeMessage) throws
407407
408408 /**
409409 * Checks the signature on an S/MIME signed MIME multipart.
410- *
410+ *
411411 * @param mimeMultipart
412412 * The {@link MimeMultipart} to be checked.
413413 * @return {@code true} if the multipart is correctly signed, {@code false}
@@ -423,7 +423,7 @@ public static boolean checkSignature(MimeMultipart mimeMultipart) {
423423
424424 /**
425425 * Checks the signature on an S/MIME signed MIME part (i.e. MIME message).
426- *
426+ *
427427 * @param mimePart
428428 * The {@link MimePart} to be checked.
429429 * @return {@code true} if the part is correctly signed, {@code false}
@@ -542,7 +542,7 @@ private static SignerInformationVerifier getVerifier(X509Certificate certificate
542542
543543 /**
544544 * Returns the signed MIME body part of an S/MIME signed MIME multipart.
545- *
545+ *
546546 * @param mimeMultipart
547547 * The {@link MimeMultipart} to be stripped off.
548548 * @return The signed {@link MimeBodyPart} contained in the
@@ -559,7 +559,7 @@ public static MimeBodyPart getSignedContent(MimeMultipart mimeMultipart) {
559559 /**
560560 * Returns the signed MIME body part of an S/MIME signed MIME part (i.e. MIME
561561 * message).
562- *
562+ *
563563 * @param mimePart
564564 * The {@link MimePart} to be stripped off.
565565 * @return The signed {@link MimeBodyPart} contained in the {@link MimePart}
@@ -581,7 +581,7 @@ public static MimeBodyPart getSignedContent(MimePart mimePart) {
581581
582582 /**
583583 * Returns the S/MIME state of a MIME multipart.
584- *
584+ *
585585 * @param mimeMultipart
586586 * The {@link MimeMultipart} to be checked.
587587 * @return the {@link SmimeState} of the {@link MimeMultipart}.
@@ -596,7 +596,7 @@ public static SmimeState getStatus(MimeMultipart mimeMultipart) {
596596
597597 /**
598598 * Returns the S/MIME state of a MIME part (i.e. MIME message).
599- *
599+ *
600600 * @param mimePart
601601 * The {@link MimePart} to be checked.
602602 * @return the {@link SmimeState} of the {@link MimePart}.
@@ -629,8 +629,9 @@ private static boolean isSmimeEncryptionContenttype(ContentType contentType) {
629629
630630 private static boolean isSmimeSignatureContentType (ContentType contentType ) {
631631 String baseContentType = contentType .getBaseType ();
632+ String protocol = contentType .getParameter ("protocol" );
632633 return baseContentType .equalsIgnoreCase ("multipart/signed" )
633- && isSmimeSignatureProtocoll (contentType . getParameter ( " protocol" ) );
634+ && protocol != null && isSmimeSignatureProtocoll (protocol );
634635 }
635636
636637 private static boolean isSignatureSmimeType (ContentType contentType ) {
0 commit comments