Skip to content

Commit

Permalink
Extra test case
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdettman committed Nov 9, 2021
1 parent 97b31d6 commit 50afd06
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/src/test/java/org/bouncycastle/asn1/test/TagTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

import org.bouncycastle.asn1.ASN1ApplicationSpecific;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERApplicationSpecific;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.util.encoders.Base64;
import org.bouncycastle.util.encoders.Hex;
import org.bouncycastle.util.test.SimpleTest;
Expand All @@ -30,6 +32,8 @@ public class TagTest

byte[] longAppSpecificTag = Hex.decode("5F610101");

byte[] taggedInteger = Hex.decode("BF2203020101");

public String getName()
{
return "Tag";
Expand Down Expand Up @@ -104,6 +108,13 @@ public void performTest()
fail("incorrect tag number read on recode (random test value: " + testTag + ")");
}
}

tagged = new DERTaggedObject(false, 34, new DERTaggedObject(true, 1000, new ASN1Integer(1)));

if (!areEqual(taggedInteger, tagged.getEncoded()))
{
fail("incorrect encoding for implicit explicit tagged integer");
}
}

public static void main(
Expand Down

0 comments on commit 50afd06

Please sign in to comment.