I. Overview

%%{init: { 'theme': 'base', 'themeVariables': { 'edgeLabelBackground': '#fff' }}}%%
flowchart LR
    A["Sign the\nplaintext"] -- "Encrypt the whole package after signing" --> B["Signer identity protected\nand confidentiality assured"]
    style A fill:#f9f9f9,stroke:#333,stroke-width:3px
    style B fill:#e1f5fe,stroke:#01579b,stroke-width:3px

Definition: A method in which the sender generates a digital signature over the plaintext message using their own private key, attaches it, and then encrypts the entire combination with the recipient’s public key (or a session key) before transmission.

Core Value:
( Confidentiality and Integrity ) The entire message is encrypted to protect its contents, and the signature confirms whether it has been tampered with
( Non-repudiation and Authentication ) Including a signature made with the sender’s private key provides identity confirmation and non-repudiation
( Attack Resistance ) Encrypting even the signer’s information blocks third parties from obtaining it, and it resists replay attacks

II. Mechanism & Components

A. Step-by-Step Process

flowchart TD
    M["Plaintext message (M)"] --> Hash["Hash function (H)"]
    Hash --> Sign["Encrypt with sender's private key (Sign)"]
    Sign --> S["Digital signature (S)"]

    M --- Combine["Combine M || S"]
    S --- Combine

    Combine --> Enc["Encrypt with session key (Encrypt)"]
    K["One-time session key (K)"] --> Enc
    Enc --> C["Ciphertext (C)"]

    K --> Env["Encrypt with recipient's public key (Envelope)"]
    Env --> E["Digital envelope (Env)"]

    C --- Final["Final transmission [C + Env]"]
    E --- Final

Detailed mechanism:

  • Sign step: The message is hashed (H) and encrypted with the sender’s private key (Pr_A) to produce the signature (S): S = E(Pr_A, H(M))
  • Combine step: The original message and the signature are combined: M' = M || S
  • Encrypt step: The combined message is encrypted with a symmetric session key, and the session key itself is encrypted with the recipient’s public key (Pu_B) as a digital envelope: C = E(K, M'), Env = E(Pu_B, K)
  • Transmission: [C, Env] is sent to the recipient

B. Security Benefits and Features

CategoryDetailsSecurity Value
Authentication and Non-repudiationUses the sender’s private keyProvides solid evidence of “who sent it”
Integrity AssuredIncludes a hash value and signatureDetects even a single-bit alteration in transit
Confidentiality MaintainedEntire package is encryptedA third party cannot learn the message content or the identity of the signer
Attack ResistanceDefends against surreptitious forwardingResists an attack where someone intercepts only the signature and replays it

III. Advanced Topics & Comparison

Comparison ItemSign-then-Encrypt (Recommended)Encrypt-then-Sign
Order of OperationsSign first, then encrypt the whole thingEncrypt first, then sign the ciphertext
Signature TargetHash of the original message (plaintext)Hash of the ciphertext
Confidentiality LevelHigh (the signer’s identity is also encrypted)Moderate (the signer may be exposed)
Standard UseS/MIME, PGP, application-level securityIPSec (network layer), among others

Last updated 18 Aug 2026, 00:00 UTC. history