From d48f816d5b25a275b2b85771d614919fd04beec0 Mon Sep 17 00:00:00 2001 From: Heiko Schaefer Date: Fri, 1 Dec 2023 22:21:41 +0100 Subject: [PATCH] ch12: compression draft --- book/source/12-compression.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/book/source/12-compression.md b/book/source/12-compression.md index 9e3a0f5..c53e379 100644 --- a/book/source/12-compression.md +++ b/book/source/12-compression.md @@ -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 +```