E-Mail Security

From Elvis Wiki
Revision as of 12:04, 17 December 2024 by AMessner (talk | contribs) (→‎Integrity)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Summary

This article provides a detailed comparison and explanation of three major encryption methods used for securing email communication: Transport Layer Security (TLS), OpenPGP, and Secure/Multipurpose Internet Mail Extensions (S/MIME).

Transport Layer Security (TLS)

TLS is a cryptographic protocol that secures communications over a network by providing confidentiality, integrity, and authentication. It is commonly used to secure connections between a client and a server, as well as between servers.

Confidentiality

  • Data is encrypted during transit to ensure it cannot be intercepted and read.
  • TLS uses asymmetric encryption during the handshake phase to securely exchange a symmetric session key, which is then used for fast and efficient encryption of the data.

Integrity

  • Message Authentication Codes (MACs) ensure that any modification of the transmitted data is detected.
  • TLS 1.3 uses Authenticated Encryption with Associated Data (AEAD) ciphers.

Authentication

  • TLS uses digital certificates issued by trusted Certificate Authorities (CAs) to confirm the identity of the communicating parties.
  • The server presents its certificate to the client during the handshake phase to prove its legitimacy.
  • Optionally, mutual authentication can occur, where the client also provides its certificate.

How TLS operates

TLS operates in two stages:

  1. TLS Handshake Protocol
    • This phase negotiates security parameters, including the cryptographic algorithms to be used (cipher suites).
    • The server sends its certificate to the client, which verifies the certificate against trusted CAs.
    • Optional client authentication can occur here if needed.
    • A session key, that will be used as a symmetric key, is exchanged using encrypted key-exchange.
    • MACs ensure that data integrity is preserved.
  2. TLS Record Protocol
    • After the handshake, the Record Protocol manages the symmetric encrypted transmission of data.
    • Data is encrypted using the session key established during the handshake.
    • MACs ensure that data integrity is preserved.

Limitations

  • Encryption Only During Transmission: TLS protects emails only during transmission. Once the email reaches the server or the recipient's device, the content is unencrypted and stored as plain text unless additional end-to-end encryption is used.
  • No Guarantee of TLS Usage at Every Step in Communication: TLS cannot guarantee encryption for the entire journey of an email. After leaving the sender's device, emails often pass through multiple intermediary Mail Transfer Agents (MTAs) before reaching the recipient. If any of these MTAs do not support or enforce TLS, the email may be transmitted in plaintext, exposing it to potential interception. Additionally, the sender has no control over whether these intermediary MTAs adhere to TLS requirements, leaving a gap in secure delivery.

OpenPGP

OpenPGP is an encryption standard designed to provide end-to-end encryption, ensuring that only the intended recipient can read the message. It combines symmetric and asymmetric cryptography, as well as digital signatures, to achieve confidentiality, authenticity, and integrity. It uses compression to reduce the size of the email content before encryption. OpenPGP uses the Web of Trust or other communication channels to share Public Keys.

Confidentiality

  • OpenPGP uses symmetric encryption to encrypt the email content efficiently.
  • The symmetric key (called the session key) is encrypted using the recipient's public key and attached to the email.
  • Only the recipient can decrypt the session key using their private key, ensuring the message remains confidential.

Integrity

  • OpenPGP advices to use AEAD algorithms.
  • Older Implementations used MDC (Message Detection Code), or a simple Signature on a hash digest.

Authentication

  • Digital signatures validate the sender's identity by linking the message to their private key. They also confirm the message’s integrity, ensuring it has not been altered.

How OpenPGP operates

  1. Encryption Process:
    • The sender's OpenPGP implementation generates a random session key.
    • The email content is compressed and encrypted using the session key.
    • The session key is encrypted using the recipient's public key and attached to the message.
  2. Decryption Process:
    • The recipient decrypts the session key using their private key.
    • The session key is used to decrypt the email content.
    • If compression was used, the message is decompressed after decryption.
  3. Digital Signature:
    • A hash of the email is created using a cryptographic hash function.
    • The hash is encrypted with the sender's private key to create the signature.
    • The recipient verifies the signature by decrypting the hash using the sender's public key.

Limitations

  • Lack of Central Trust: Trust is established manually through the Web of Trust, unlike S/MIME's centralized PKI.
  • Complexity: OpenPGP requires key management, which can be challenging for less technical users.

Secure/Multipurpose Internet Mail Extensions (S/MIME)

S/MIME is a standard for securing email communication with end-to-end encryption through encryption and digital signatures. Unlike OpenPGP, S/MIME relies on a centralized Public Key Infrastructure (PKI) to manage certificates, making it a more enterprise-friendly solution.

Confidentiality

  • S/MIME uses the CMS (Cryptographic Message Syntax) format for encryption.
  • A symmetric Content Encryption Key (CEK) is used to encrypt the email content.
  • The CEK is encrypted using the recipient's public key and attached to the message.

Integrity

  • A hash of the email content is signed using the sender's private key.
  • The recipient verifies the signature using the sender's public key, ensuring authenticity and integrity.
  • S/MIME specification advices to use AEAD algorithms.

Authentication

  • Certificates issued by trusted Certificate Authorities (CAs) manage sender verification.
  • Digital Signatures are used to verify the sender's identity, a hash of the message is signed with the sender's private key.

How S/MIME operates

  1. Encryption:
    • The sender generates a random CEK to encrypt the email content using a symmetric encryption algorithm.
    • The CEK is encrypted using the recipient's public key and attached to the message.
  2. Decryption:
    • The recipient decrypts the CEK using their private key.
    • The CEK is then used to decrypt the email content.
  3. Digital Signatures:
    • A hash of the email content is signed using the sender's private key.
    • The recipient verifies the signature using the sender's public key, ensuring authenticity and integrity.

Message Formats

  • Application/PKCS7-MIME: Encapsulates the entire message and signature, requiring the recipient to have S/MIME support to read the content.
  • Multipart/Signed: Keeps the email content in plain text while attaching the signature separately, enabling compatibility with non-S/MIME clients.

Limitations

  • Dependence on PKI: Users and organizations rely on third-party Certificate Authorities.
Feature TLS OpenPGP S/MIME
Encryption Scope Transport only End-to-end End-to-end
Certificate Management Centralized (PKI) Decentralized (Web of Trust) Centralized (PKI)
Digital Signatures No Yes Yes
Key Management Transparent to users Manual (user-controlled) Automated (certificate-based)
Complexity Low Moderate Moderate

Courses

References