summary refs log tree commit diff
path: root/crypto/src/bcpg/SignaturePacket.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-10-14 01:05:16 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-10-14 01:05:16 +0700
commit1b15bfc5d4b7e478887f5202c74e563382ffa2d9 (patch)
treef4eedff7c22b12b5a9ad5b1ef474159505aa09f7 /crypto/src/bcpg/SignaturePacket.cs
parentImprove ASN.1 set special handling (diff)
downloadBouncyCastle.NET-ed25519-1b15bfc5d4b7e478887f5202c74e563382ffa2d9.tar.xz
Ignore PGP signatures with invalid version
Diffstat (limited to 'crypto/src/bcpg/SignaturePacket.cs')
-rw-r--r--crypto/src/bcpg/SignaturePacket.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/src/bcpg/SignaturePacket.cs b/crypto/src/bcpg/SignaturePacket.cs
index 70138d584..9a664f902 100644
--- a/crypto/src/bcpg/SignaturePacket.cs
+++ b/crypto/src/bcpg/SignaturePacket.cs
@@ -5,6 +5,7 @@ using System.IO;
 using Org.BouncyCastle.Bcpg.Sig;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Date;
+using Org.BouncyCastle.Utilities.IO;
 
 namespace Org.BouncyCastle.Bcpg
 {
@@ -121,7 +122,9 @@ namespace Org.BouncyCastle.Bcpg
             }
             else
             {
-                throw new Exception("unsupported version: " + version);
+                Streams.Drain(bcpgIn);
+
+                throw new UnsupportedPacketVersionException("unsupported version: " + version);
             }
 
 			fingerprint = new byte[2];