From 212ec41dd10152391c5218c0a6c98af31ff02d6f Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 10 Nov 2021 00:38:54 +0700 Subject: Handle high tag numbers --- crypto/test/src/asn1/test/TagTest.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'crypto/test') diff --git a/crypto/test/src/asn1/test/TagTest.cs b/crypto/test/src/asn1/test/TagTest.cs index 80ca2c0ea..fd6995c44 100644 --- a/crypto/test/src/asn1/test/TagTest.cs +++ b/crypto/test/src/asn1/test/TagTest.cs @@ -27,6 +27,8 @@ namespace Org.BouncyCastle.Asn1.Tests private static readonly byte[] longAppSpecificTag = Hex.Decode("5F610101"); + private static readonly byte[] taggedInteger = Hex.Decode("BF2203020101"); + public override string Name { get { return "Tag"; } @@ -100,9 +102,16 @@ namespace Org.BouncyCastle.Asn1.Tests Fail("incorrect tag number read on recode (random test value: " + testTag + ")"); } } - } - public static void Main( + tagged = new DerTaggedObject(false, 34, new DerTaggedObject(true, 1000, new DerInteger(1))); + + if (!AreEqual(taggedInteger, tagged.GetEncoded())) + { + Fail("incorrect encoding for implicit explicit tagged integer"); + } + } + + public static void Main( string[] args) { RunTest(new TagTest()); -- cgit 1.5.1