2.6 KiB
Encryption
Encryption is one of the core facilities of OpenPGP. It provides confidentiality.
For implementation details and discussion of advanced concepts, see . For an in-depth, packet-level view of encrypted data in OpenPGP, see .
High-Level overview of the message encryption process
Encryption in OpenPGP is performed in two distinct steps:
- Session key transmission: For each recipient of the message, a packet that contains a protected copy of the session key is generated.
- Symmetric encryption: The actual message is encrypted based on the session key. The (potentially large) ciphertext only needs to be stored once, even if it is sent to multiple recipients. All recipients get access to the same shared session key to decrypt the message.
Above, "plaintext" means one of:
- *Literal Data* packet,
- *Compressed Data* packet or a
- *signed message*.
A *signed message*, in turn, is a packet sequence that either
- resembles an *inline-signed message* (a *Literal Data* packet sandwhiched between one or more *One-Pass-Signature* and their respective *Signature* packets), or a
- *prefixed-signed* message (one or more *Signature* packets followed by a single *Literal Data* packet).
Session key transmission
- Usually, the session key is encrypted to a public encryption component key of the recipient.
- Alternatively - or additionally - the session key may also be encrypted using a passphrase. This is a specialized and less commonly used mode of operation that doesn't require OpenPGP certificates.
Session key encrypted for a recipient's component key
Session key encrypted to a passphrase
Symmetric encryption of data
Different versions of encrypted data in OpenPGP have been specified over time. They use different cryptographic mechanisms, internally, and the assurances they provide differ. However, from an application perspective, all of them are applied in the same way:
The plaintext data is encrypted using a symmetric session key. To decrypt, the same session key is used.
The stored plain text consists of an OpenPGP message. That is, after decryption, the data is formatted as a series of OpenPGP packets.