From aac29ea7c78c14d97a9d3b2f2a91e28750dd7bba Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 20 Feb 2020 01:05:05 +0700 Subject: PGP updates from bc-java --- crypto/src/openpgp/PgpSignature.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'crypto/src/openpgp/PgpSignature.cs') diff --git a/crypto/src/openpgp/PgpSignature.cs b/crypto/src/openpgp/PgpSignature.cs index c8c541bef..fb6244725 100644 --- a/crypto/src/openpgp/PgpSignature.cs +++ b/crypto/src/openpgp/PgpSignature.cs @@ -12,6 +12,14 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp /// A PGP signature object. public class PgpSignature { + private static SignaturePacket Cast(Packet packet) + { + if (!(packet is SignaturePacket)) + throw new IOException("unexpected packet in stream: " + packet); + + return (SignaturePacket)packet; + } + public const int BinaryDocument = 0x00; public const int CanonicalTextDocument = 0x01; public const int StandAlone = 0x02; @@ -38,7 +46,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp internal PgpSignature( BcpgInputStream bcpgInput) - : this((SignaturePacket)bcpgInput.ReadPacket()) + : this(Cast(bcpgInput.ReadPacket())) { } -- cgit 1.4.1