mirror of
https://codeberg.org/openpgp/notes.git
synced 2024-11-29 19:12:06 +01:00
46 lines
2.6 KiB
Markdown
46 lines
2.6 KiB
Markdown
<!--
|
|
SPDX-FileCopyrightText: 2023 The "Notes on OpenPGP" project
|
|
SPDX-License-Identifier: CC-BY-SA-4.0
|
|
-->
|
|
|
|
# Encryption
|
|
|
|
[Encryption](https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-12.html#name-confidentiality-via-encrypt) is one of the core facilities of OpenPGP. It provides confidentiality.
|
|
|
|
For implementation details and discussion of advanced concepts, see [](/adv/encryption).
|
|
For an in-depth, packet-level view of encrypted data in OpenPGP, see [](/zoom/encryption).
|
|
|
|
## High-Level overview of the message encryption process
|
|
|
|
Encryption in OpenPGP is performed in two distinct steps:
|
|
|
|
1. **Session key transmission**: For each recipient of the message, a packet that contains a protected copy of the session key is generated.
|
|
2. **Symmetric encryption**: The actual message is encrypted based on the [*session key*](https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-12.html#name-confidentiality-via-encrypt). 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.
|
|
|
|
```{note}
|
|
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](https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-12.html#name-openpgp-messages). That is, after decryption, the data is formatted as a series of OpenPGP packets.
|