summary refs log tree commit diff
path: root/crypto/src/asn1/cms/SignedDataParser.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@gmail.com>2022-06-22 01:40:55 +0700
committerPeter Dettman <peter.dettman@gmail.com>2022-06-22 01:40:55 +0700
commit892dbe845c98ff3fad3d682aaed3cd40b3161d4f (patch)
tree785ea8dc92cde60b6c06d5f56f6c3f0cda69bb2c /crypto/src/asn1/cms/SignedDataParser.cs
parentCleanup old build systems (diff)
downloadBouncyCastle.NET-ed25519-892dbe845c98ff3fad3d682aaed3cd40b3161d4f.tar.xz
ObsoleteAttribute cleanup
Diffstat (limited to 'crypto/src/asn1/cms/SignedDataParser.cs')
-rw-r--r--crypto/src/asn1/cms/SignedDataParser.cs28
1 files changed, 16 insertions, 12 deletions
diff --git a/crypto/src/asn1/cms/SignedDataParser.cs b/crypto/src/asn1/cms/SignedDataParser.cs
index cd07f4057..64114f292 100644
--- a/crypto/src/asn1/cms/SignedDataParser.cs
+++ b/crypto/src/asn1/cms/SignedDataParser.cs
@@ -64,12 +64,14 @@ namespace Org.BouncyCastle.Asn1.Cms
 			_certsCalled = true;
 			_nextObject = _seq.ReadObject();
 
-			if (_nextObject is Asn1TaggedObjectParser && ((Asn1TaggedObjectParser)_nextObject).TagNo == 0)
+			if (_nextObject is Asn1TaggedObjectParser o)
 			{
-				Asn1SetParser certs = (Asn1SetParser)((Asn1TaggedObjectParser)_nextObject).GetObjectParser(Asn1Tags.Set, false);
-				_nextObject = null;
-
-				return certs;
+				if (o.HasContextTag(0))
+				{
+					Asn1SetParser certs = (Asn1SetParser)o.ParseBaseUniversal(false, Asn1Tags.SetOf);
+					_nextObject = null;
+					return certs;
+				}
 			}
 
 			return null;
@@ -87,16 +89,18 @@ namespace Org.BouncyCastle.Asn1.Cms
 				_nextObject = _seq.ReadObject();
 			}
 
-			if (_nextObject is Asn1TaggedObjectParser && ((Asn1TaggedObjectParser)_nextObject).TagNo == 1)
+			if (_nextObject is Asn1TaggedObjectParser o)
 			{
-				Asn1SetParser crls = (Asn1SetParser)((Asn1TaggedObjectParser)_nextObject).GetObjectParser(Asn1Tags.Set, false);
-				_nextObject = null;
-
-				return crls;
+				if (o.HasContextTag(1))
+				{
+					Asn1SetParser crls = (Asn1SetParser)o.ParseBaseUniversal(false, Asn1Tags.SetOf);
+					_nextObject = null;
+					return crls;
+				}
 			}
 
-			return null;
-		}
+            return null;
+        }
 
 		public Asn1SetParser GetSignerInfos()
 		{