From 74c7b025a0aa49f947fedb1753a72bcee4334858 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 30 Nov 2023 19:36:01 +0100 Subject: [PATCH] Do not choke on unknown signature subpackets Fixes #418 --- .../signature/subpackets/SignatureSubpacketsHelper.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/signature/subpackets/SignatureSubpacketsHelper.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/signature/subpackets/SignatureSubpacketsHelper.kt index 6c39432e..8a6c16bf 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/signature/subpackets/SignatureSubpacketsHelper.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/signature/subpackets/SignatureSubpacketsHelper.kt @@ -17,7 +17,7 @@ class SignatureSubpacketsHelper { fun applyFrom(vector: PGPSignatureSubpacketVector, subpackets: SignatureSubpackets) = subpackets.apply { for (subpacket in vector.toArray()) { - val type = SignatureSubpacket.requireFromCode(subpacket.type) + val type = SignatureSubpacket.fromCode(subpacket.type) when (type) { SignatureSubpacket.signatureCreationTime, SignatureSubpacket.issuerKeyId, @@ -134,6 +134,7 @@ class SignatureSubpacketsHelper { SignatureSubpacket.preferredAEADAlgorithms, SignatureSubpacket.attestedCertification -> subpackets.addResidualSubpacket(subpacket) + else -> subpackets.addResidualSubpacket(subpacket) } } }