diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2020-02-20 01:05:05 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2020-02-20 01:05:05 +0700 |
commit | aac29ea7c78c14d97a9d3b2f2a91e28750dd7bba (patch) | |
tree | 0f07b214366a3efbc71e8965b15284c27d41594d /crypto/src/openpgp/PgpSignature.cs | |
parent | Mark several EC multipliers as obsolete (diff) | |
download | BouncyCastle.NET-ed25519-aac29ea7c78c14d97a9d3b2f2a91e28750dd7bba.tar.xz |
PGP updates from bc-java
Diffstat (limited to 'crypto/src/openpgp/PgpSignature.cs')
-rw-r--r-- | crypto/src/openpgp/PgpSignature.cs | 10 |
1 files changed, 9 insertions, 1 deletions
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 /// <remarks>A PGP signature object.</remarks> 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())) { } |