From 315de6965431e47ad63d3a6cf6597d6f138cead5 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Tue, 21 Oct 2025 18:39:23 +0200 Subject: [PATCH] Fix ClassCastException when trying to verify misplaced subkey binding signatures --- .../org/bouncycastle/openpgp/api/OpenPGPCertificate.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pg/src/main/java/org/bouncycastle/openpgp/api/OpenPGPCertificate.java b/pg/src/main/java/org/bouncycastle/openpgp/api/OpenPGPCertificate.java index 267cfd72ce..04a384786f 100644 --- a/pg/src/main/java/org/bouncycastle/openpgp/api/OpenPGPCertificate.java +++ b/pg/src/main/java/org/bouncycastle/openpgp/api/OpenPGPCertificate.java @@ -1949,7 +1949,7 @@ else if (signature.getSignatureType() == PGPSignature.PRIMARYKEY_BINDING) throw new IncorrectOpenPGPSignatureException(this, "Key Signature is not correct."); } } - catch (PGPException e) + catch (PGPException | ClassCastException e) { this.isCorrect = false; throw new PGPSignatureException("Key Signature could not be verified.", e); @@ -1982,7 +1982,7 @@ protected void verifyUserIdSignature(OpenPGPComponentKey issuer, throw new IncorrectOpenPGPSignatureException(this, "UserID Signature is not correct."); } } - catch (PGPException e) + catch (PGPException | ClassCastException e) { this.isCorrect = false; throw new PGPSignatureException("UserID Signature could not be verified.", e); @@ -2015,7 +2015,7 @@ protected void verifyUserAttributeSignature(OpenPGPComponentKey issuer, throw new IncorrectOpenPGPSignatureException(this, "UserAttribute Signature is not correct."); } } - catch (PGPException e) + catch (PGPException | ClassCastException e) { this.isCorrect = false; throw new PGPSignatureException("Could not verify UserAttribute Signature.", e);