K078 / Cryptographic protocols and formats
S/MIME
A cryptographic protocol recommended for end-to-end email authentication and confidentiality.
CRYPTOGRAPHY LAB / K078
Cryptography Lab · S/MIME
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
S/MIME CMS (content encryption AES-CBC + padding only; no CMS envelope/signatures)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- A cryptographic protocol recommended for end-to-end email authentication and confidentiality. Source document ↗
- Classification and reversibility
- Public-key encryption/signature format; recipient private key decrypts. Source document ↗
- Key or secret requirements
- Requires symmetric session key and recipient public/private keys. Source document ↗
- Operating principle and structure
- Hybrid: random symmetric key encrypts body, public key protects symmetric key. Source document ↗
- Key size, block size and parameters
- Parameters include ECDH P-256, X25519/HKDF-256, RSA/RSAES-OAEP. Source document ↗
- Security strength and recommendation
- NIST plans RSA/ECC key-establishment deprecation after 2030 and disallowance after 2035. Source document ↗
- Known attacks and vulnerabilities
- EFAIL S/MIME plaintext exposure vulnerability (CVE-2017-17689). Source document ↗
- Standards and certification
- RFC 5750/5751 proposed Internet standards, updated by RFC 8551. Source document ↗
- Typical uses
- Email authentication/integrity/nonrepudiation by signing, confidentiality by encryption. Source document ↗
- Implementations, libraries and tools
- Jakarta Mail/Bouncy Castle, Simple Java Mail, MimeKit and PKI.js. Source document ↗
- Decryption or decoding
- Decrypt CMS EnvelopedData using recipient private key held in certificate container such as PKCS12. Source document ↗
- Advantages
- Signature provides authentication, integrity and nonrepudiation; encryption confidentiality. Source document ↗
- Limitations and cautions
- Only body encrypted, headers exposed; beware client weaknesses such as EFAIL. Source document ↗
- Distinguishing encryption, encoding and hashing
- application/pkcs7-mime encryption container, not encoding/hashing. Source document ↗
Practical examples
Example
Protect session key with recipient certificate public key, encrypt body symmetrically and send application/pkcs7-mime. Recipient private key unwraps and decrypts; verify signatures via certificate chain.
Procedure
Validate recipient certificate/trust, build MIME body, encrypt CMS EnvelopedData, send pkcs7-mime. Load recipient private key/PKCS12, decrypt EnvelopedData, verify signatures then render safely. Distinguish signing/encryption/header protection.
Scenario
Financial/legal departments exchange contracts/personal data by email with end-to-end confidentiality/signature checks. Enterprise gateways/clients distribute/renew certificates and automate encryption and verification.
Pitfalls and alternatives
Headers exposed by default; legacy RC2/CBC and active HTML rendering increase EFAIL risk. Use modern algorithms, certificate validation, header protection and safe clients; not hash/encoding.
References
- Trustworthy Email ↗
- S/MIME enveloped-data (encrypted) emails - OraRSA tutorial - DidiSoft ↗
- NIST SP 800-45 Version 2, Guidelines on Electronic Mail Security ↗
- RFC 8551: Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Message Specification | RFC Editor ↗
- Email encryption and quantum computers: S/MIME, PGP and TLS ↗
- OpenPGP and S/MIME Guide: Email Encryption and Signing ↗
- simple-java-mail/java-utils-mail-smime ↗
- S/MIME | Meziantou.Framework ↗
- S/MIME - secure mail - Rebex Mail Pack - Rebex.NET ↗
- Working with S/MIME ↗