summary refs log tree commit diff
path: root/crypto/src/asn1/isismtt
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-07-18 12:06:03 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-07-18 12:06:03 +0700
commit913eada3ad9394f1327a1feb80a3261f7c6e55bb (patch)
tree6366c1e196ad2ac249edf12a4d41d52ee2d28629 /crypto/src/asn1/isismtt
parentRefactoring around PrivateKeyInfo (diff)
downloadBouncyCastle.NET-ed25519-913eada3ad9394f1327a1feb80a3261f7c6e55bb.tar.xz
Deprecated Asn1TaggedObject.GetObject and refactor
Diffstat (limited to 'crypto/src/asn1/isismtt')
-rw-r--r--crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs9
-rw-r--r--crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs4
-rw-r--r--crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs8
3 files changed, 7 insertions, 14 deletions
diff --git a/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs b/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs
index 0348b0916..e2de8882d 100644
--- a/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs
+++ b/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs
@@ -70,14 +70,9 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.Ocsp
             throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj");
 		}
 
-		public static RequestedCertificate GetInstance(
-			Asn1TaggedObject	obj,
-			bool				isExplicit)
+		public static RequestedCertificate GetInstance(Asn1TaggedObject obj, bool isExplicit)
 		{
-			if (!isExplicit)
-				throw new ArgumentException("choice item must be explicitly tagged");
-
-			return GetInstance(obj.GetObject());
+			return Asn1Utilities.GetInstanceFromChoice(obj, isExplicit, GetInstance);
 		}
 
 		private RequestedCertificate(
diff --git a/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs b/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs
index 471776630..f20d17f6b 100644
--- a/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs
+++ b/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs
@@ -73,8 +73,8 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509
 			if (obj is DeclarationOfMajority declarationOfMajority)
 				return declarationOfMajority;
 
-			if (obj is Asn1TaggedObject asn1TaggedObject)
-				return new DeclarationOfMajority(asn1TaggedObject);
+			if (obj is Asn1TaggedObject taggedObject)
+				return new DeclarationOfMajority(Asn1Utilities.CheckTagClass(taggedObject, Asn1Tags.ContextSpecific));
 
             throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), nameof(obj));
 		}
diff --git a/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs b/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs
index 2fb7323c6..96047f9bd 100644
--- a/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs
+++ b/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs
@@ -85,11 +85,9 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509
 			if (seq.Count < 1 || seq.Count > 3)
 				throw new ArgumentException("Bad sequence size: " + seq.Count);
 
-			var e = seq.GetEnumerator();
-
-			while (e.MoveNext())
+			foreach (var element in seq)
 			{
-				Asn1TaggedObject o = Asn1TaggedObject.GetInstance(e.Current);
+				Asn1TaggedObject o = Asn1TaggedObject.GetInstance(element, Asn1Tags.ContextSpecific);
 				switch (o.TagNo)
 				{
 				case 1:
@@ -99,7 +97,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509
 					typeOfSubstitution = DirectoryString.GetInstance(o, true);
 					break;
 				case 3:
-					Asn1Object signingFor = o.GetObject();
+					Asn1Encodable signingFor = o.GetExplicitBaseObject();
 					if (signingFor is Asn1TaggedObject)
 					{
 						thirdPerson = GeneralName.GetInstance(signingFor);