Home - Yash-777/java-utils-mail-smime GitHub Wiki

Content-Type               : application/pkcs7-mime; name="smime.p7m"; smime-type=enveloped-data
Content-Transfer-Encoding  : base64
Content-Disposition        : attachment; filename="smime.p7m"
Content-Description        : S/MIME Encrypted Message

Content-Type               : application/pkcs7-signature; name=smime.p7s; smime-type=signed-data
Content-Transfer-Encoding  : base64
Content-Disposition        : attachment; filename="smime.p7s"
Content-Description        : S/MIME Cryptographic Signature

Installing Certificate in the System

Goto file Baeldung.p12. Open with Crypto Shell Extensions

Sign & Encrypt S/MIME (Secure/Multipurpose Internet Mail Extensions)

Message Body Encryption

While HTTPS is used to encrypt the entire HTTP message, S/MIME encryption is used solely for the message body of the HTTP request or response. This is very useful if you have a representation that may be forwarded by multiple parties and you want to protect the message from prying eyes as it travels across the network.

Header Key Header Value
Content-Type application/pkcs7-mime; name="smime.p7m"; smime-type=enveloped-data
Content-Transfer-Encoding base64
Content-Disposition attachment; filename="smime.p7m"
Content-Description S/MIME Encrypted Message

Message Body Signing

S/MIME also allows you to digitally sign a message. It uses the multipart/signed data format which is a multipart message that contains the entity and the digital signature.

Header Key Header Value
Content-Type application/pkcs7-signature; name=smime.p7s; smime-type=signed-data
Content-Transfer-Encoding base64
Content-Disposition attachment; filename="smime.p7s"
Content-Description S/MIME Cryptographic Signature