summary refs log tree commit diff
path: root/crypto/src/asn1/crmf/OptionalValidity.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2024-06-24 20:04:26 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2024-06-24 20:04:26 +0700
commit438dc8d53aac9b7483a2014cd4398b8275c496ab (patch)
treed4e53f01313d43c20cf32ae5c930e0d54a364114 /crypto/src/asn1/crmf/OptionalValidity.cs
parentAdd TODO (diff)
downloadBouncyCastle.NET-ed25519-438dc8d53aac9b7483a2014cd4398b8275c496ab.tar.xz
ASN.1: Use GetTagged with cursor methods
- Add GetTagged method for all CHOICE types
- Make most Asn1Utilities methods public
Diffstat (limited to 'crypto/src/asn1/crmf/OptionalValidity.cs')
-rw-r--r--crypto/src/asn1/crmf/OptionalValidity.cs13
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/src/asn1/crmf/OptionalValidity.cs b/crypto/src/asn1/crmf/OptionalValidity.cs
index 290d1905e..9abeaca87 100644
--- a/crypto/src/asn1/crmf/OptionalValidity.cs
+++ b/crypto/src/asn1/crmf/OptionalValidity.cs
@@ -16,10 +16,11 @@ namespace Org.BouncyCastle.Asn1.Crmf
             return new OptionalValidity(Asn1Sequence.GetInstance(obj));
         }
 
-        public static OptionalValidity GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
-        {
-            return new OptionalValidity(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
-        }
+        public static OptionalValidity GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) =>
+            new OptionalValidity(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
+
+        public static OptionalValidity GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) =>
+            new OptionalValidity(Asn1Sequence.GetTagged(taggedObject, declaredExplicit));
 
         private readonly Time m_notBefore;
         private readonly Time m_notAfter;
@@ -34,8 +35,8 @@ namespace Org.BouncyCastle.Asn1.Crmf
 
             int pos = 0;
 
-            m_notBefore = Asn1Utilities.ReadOptionalContextTagged(seq, ref pos, 0, true, Time.GetInstance);
-            m_notAfter = Asn1Utilities.ReadOptionalContextTagged(seq, ref pos, 1, true, Time.GetInstance);
+            m_notBefore = Asn1Utilities.ReadOptionalContextTagged(seq, ref pos, 0, true, Time.GetTagged);
+            m_notAfter = Asn1Utilities.ReadOptionalContextTagged(seq, ref pos, 1, true, Time.GetTagged);
 
             if (pos != count)
                 throw new ArgumentException("Unexpected elements in sequence", nameof(seq));