github corrected order of check for PRIVATE tag
@@ -256,6 +256,11 @@ public ASN1Primitive readObject()
IndefiniteLengthInputStream indIn = new IndefiniteLengthInputStream(this, limit);
ASN1StreamParser sp = new ASN1StreamParser(indIn, limit);
+ if ((tag & PRIVATE) == PRIVATE)
+ {
+ return new BERPrivateParser(tagNo, sp).getLoadedObject();
+ }
+
if ((tag & APPLICATION) != 0)
{
return new BERApplicationSpecificParser(tagNo, sp).getLoadedObject();
@@ -266,11 +271,6 @@ public ASN1Primitive readObject()
return new BERTaggedObjectParser(true, tagNo, sp).getLoadedObject();
}
- if ((tag & PRIVATE) != 0)
- {
- return new BERPrivateParser(tagNo, sp).getLoadedObject();
- }
-
// TODO There are other tags that may be constructed (e.g. BIT_STRING)
switch (tagNo)
{
