From 0045f775510b66a14e276779d3e0dc52f45a02b4 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 12 Jun 2024 22:11:47 +0200 Subject: [PATCH] Catch UnsupportedPacketVersionExceptions when parsing OnePassSignaturePackets --- .../OpenPgpMessageInputStream.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/decryption_verification/OpenPgpMessageInputStream.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/decryption_verification/OpenPgpMessageInputStream.kt index ca2159fc..071d8927 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/decryption_verification/OpenPgpMessageInputStream.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/decryption_verification/OpenPgpMessageInputStream.kt @@ -197,9 +197,13 @@ class OpenPgpMessageInputStream( private fun processOnePassSignature() { syntaxVerifier.next(InputSymbol.ONE_PASS_SIGNATURE) - val ops = packetInputStream!!.readOnePassSignature() - LOGGER.debug( - "One-Pass-Signature Packet by key ${ops.keyID.openPgpKeyId()} at depth ${layerMetadata.depth} encountered.") + val ops = + try { + packetInputStream!!.readOnePassSignature() + } catch (e: UnsupportedPacketVersionException) { + LOGGER.debug("Unsupported One-Pass-Signature packet version encountered.", e) + return + } signatures.addOnePassSignature(ops) }