Merge branch 'heiko-ch12' into draft

This commit is contained in:
Heiko Schaefer 2023-12-02 18:03:38 +01:00
commit 63f6751c4e
No known key found for this signature in database
GPG key ID: DAE9A9050FCCF1EB

View file

@ -5,6 +5,29 @@ SPDX-License-Identifier: CC-BY-SA-4.0
# Compression
## Zooming in: Packet structure
Optional compression of data is one element of OpenPGP's composable functionality. Compression within OpenPGP can be convenient to applications.
### Decompression yields a 'wrapped' openpgp packet stream
In one use case, this functionality is particularly helpful: When encrypting a message, the encrypted output is by definition high-entropy, and cannot be compressed anymore - even if the plaintext message was low-entropy, and could have been compressed well (like, for example, a text-file).
This means that to use whatever potential for compression exists, the message must be compressed *before* encryption. OpenPGP offers an integrated compression mechanism to make this convenient (otherwise, messages would need to be compressed and decompressed before and after encryption, to achieve the same space-efficiency).
## Decompression yields a 'wrapped' OpenPGP packet stream
Compression in OpenPGP is a simple mechanism: A [Compressed Data packet](https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-12.html#name-compressed-data-packet-type) acts as a compressed container for a series of OpenPGP packets.
The compressed data packet consists of the specification of which compression algorithm is used, followed by a compressed representation of the contained data.
The series of OpenPGP packets inside the Compressed Data packet can be handled like any stream of OpenPGP packets.
## Typical usage
Compressed data packets are often used inside [encrypted data packets](encryption_chapter), or wrapping the data of an [inline-signed message](inline_signature).
---
```{admonition} TODO
:class: warning
link to a packet dump example that shows compression
```