Add comment about readSignatures skipping compressed data packets

This commit is contained in:
Paul Schaub 2022-05-08 11:34:56 +02:00
parent 12e62d381c
commit 8fd67da973
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 5 additions and 0 deletions

View File

@ -249,8 +249,13 @@ public final class SignatureUtils {
int i = 0;
Object nextObject;
while (i++ < maxIterations && (nextObject = objectFactory.nextObject()) != null) {
// Since signatures are indistinguishable from randomness, there is no point in having them compressed,
// except for an attacker who is trying to exploit flaws in the decompression algorithm.
// Therefore, we ignore compressed data packets without attempting decompression.
if (nextObject instanceof PGPCompressedData) {
PGPCompressedData compressedData = (PGPCompressedData) nextObject;
// getInputStream() does not do decompression, contrary to getDataStream().
Streams.drain(compressedData.getInputStream()); // Skip packet without decompressing
}