summary refs log tree commit diff
path: root/crypto/src/asn1/ASN1StreamParser.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-10-15 15:37:14 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-10-15 15:37:14 +0700
commit19d87bee16fef5f1e1df518dba467ded14cf6915 (patch)
tree2f4cbbaa16874cd4bda50df9e4d65548866ec45f /crypto/src/asn1/ASN1StreamParser.cs
parentUpdate tag constants (diff)
downloadBouncyCastle.NET-ed25519-19d87bee16fef5f1e1df518dba467ded14cf6915.tar.xz
Refactoring
Diffstat (limited to 'crypto/src/asn1/ASN1StreamParser.cs')
-rw-r--r--crypto/src/asn1/ASN1StreamParser.cs32
1 files changed, 15 insertions, 17 deletions
diff --git a/crypto/src/asn1/ASN1StreamParser.cs b/crypto/src/asn1/ASN1StreamParser.cs
index cca333412..a92a3adae 100644
--- a/crypto/src/asn1/ASN1StreamParser.cs
+++ b/crypto/src/asn1/ASN1StreamParser.cs
@@ -146,32 +146,30 @@ namespace Org.BouncyCastle.Asn1
                 IndefiniteLengthInputStream indIn = new IndefiniteLengthInputStream(_in, _limit);
                 Asn1StreamParser sp = new Asn1StreamParser(indIn, _limit, tmpBuffers);
 
-                if ((tag & Asn1Tags.Application) != 0)
-				{
-					return new BerApplicationSpecificParser(tagNo, sp);
-				}
+                int tagClass = tag & Asn1Tags.Private;
+                if (0 != tagClass)
+                {
+                    if ((tag & Asn1Tags.Application) != 0)
+                        return new BerApplicationSpecificParser(tagNo, sp);
 
-				if ((tag & Asn1Tags.Tagged) != 0)
-				{
-					return new BerTaggedObjectParser(true, tagNo, sp);
-				}
+                    return new BerTaggedObjectParser(true, tagNo, sp);
+                }
 
-				return sp.ReadIndef(tagNo);
+                return sp.ReadIndef(tagNo);
 			}
 			else
 			{
 				DefiniteLengthInputStream defIn = new DefiniteLengthInputStream(_in, length, _limit);
 
-				if ((tag & Asn1Tags.Application) != 0)
-				{
-					return new DerApplicationSpecific(isConstructed, tagNo, defIn.ToArray());
-				}
+                int tagClass = tag & Asn1Tags.Private;
+                if (0 != tagClass)
+                {
+                    if ((tag & Asn1Tags.Application) != 0)
+                        return new DerApplicationSpecific(isConstructed, tagNo, defIn.ToArray());
 
-				if ((tag & Asn1Tags.Tagged) != 0)
-				{
-					return new BerTaggedObjectParser(isConstructed, tagNo,
+                    return new BerTaggedObjectParser(isConstructed, tagNo,
                         new Asn1StreamParser(defIn, defIn.Remaining, tmpBuffers));
-				}
+                }
 
                 if (!isConstructed)
                 {