Skip to content

When verify signature receive java.io.EOFException: Unexpected end of ZIP input stream #1577

Description

@brett-walker

In verify the signer of a PGP encrypted message I receive the following stacktrace:

Exception in thread "main" java.io.EOFException: Unexpected end of ZIP input stream
       at org.bouncycastle.openpgp.PGPCompressedData$2.fill(PGPCompressedData.java:155)
       at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:159)
       at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
       at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:292)
       at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
       at org.bouncycastle.bcpg.BCPGInputStream.read(BCPGInputStream.java:99)
       at org.bouncycastle.bcpg.BCPGInputStream$PartialInputStream.read(BCPGInputStream.java:432)
       at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
       at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:271)
       at org.bouncycastle.bcpg.BCPGInputStream.read(BCPGInputStream.java:82)
       at org.bouncycastle.bcpg.SignaturePacket.<init>(SignaturePacket.java:43)
       at org.bouncycastle.bcpg.BCPGInputStream.readPacket(BCPGInputStream.java:271)
       at org.bouncycastle.openpgp.PGPSignature.<init>(PGPSignature.java:74)
       at org.bouncycastle.openpgp.PGPObjectFactory.nextObject(PGPObjectFactory.java:101)
       at com.geometryit.dhhs.hms.utils.PgpDecryptor.decrypt(PgpDecryptor.java:116)
       at com.geometryit.dhhs.hms.utils.PgpDecryptor.main(PgpDecryptor.java:308)

The message was decrypted successfully with the expected message. And it was verified correctly too.
The message had the expected PGPOnePassSignatureList block before the PGPLiteralData block. It contained the ID of the expected signer.

Using version 1.77 of the Bouncy Castle libraries.
Using a Java version of Temurin-11.0.22+7
The OS platform is MacOS using Sonoma 14.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationsupport requestCommunity assistance requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions