summary refs log tree commit diff
path: root/crypto/src/asn1/cmp/NestedMessageContent.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cmp/NestedMessageContent.cs')
-rw-r--r--crypto/src/asn1/cmp/NestedMessageContent.cs27
1 files changed, 22 insertions, 5 deletions
diff --git a/crypto/src/asn1/cmp/NestedMessageContent.cs b/crypto/src/asn1/cmp/NestedMessageContent.cs
index 0cb2c080b..b9e62e218 100644
--- a/crypto/src/asn1/cmp/NestedMessageContent.cs
+++ b/crypto/src/asn1/cmp/NestedMessageContent.cs
@@ -1,4 +1,6 @@
-namespace Org.BouncyCastle.Asn1.Cmp
+using System;
+
+namespace Org.BouncyCastle.Asn1.Cmp
 {
     /**
      * NestedMessageContent ::= PKIMessages
@@ -8,13 +10,22 @@
     {
         public static new NestedMessageContent GetInstance(object obj)
         {
+            if (obj == null)
+                return null;
             if (obj is NestedMessageContent nestedMessageContent)
                 return nestedMessageContent;
+            if (obj is PkiMessages pkiMessages)
+                return new NestedMessageContent(pkiMessages);
+#pragma warning disable CS0618 // Type or member is obsolete
+            return new NestedMessageContent(Asn1Sequence.GetInstance(obj));
+#pragma warning restore CS0618 // Type or member is obsolete
+        }
 
-            if (obj != null)
-                return new NestedMessageContent(Asn1Sequence.GetInstance(obj));
-
-            return null;
+        public static new NestedMessageContent GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
+        {
+#pragma warning disable CS0618 // Type or member is obsolete
+            return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
+#pragma warning restore CS0618 // Type or member is obsolete
         }
 
         public NestedMessageContent(PkiMessage msg)
@@ -27,9 +38,15 @@
         {
         }
 
+        [Obsolete("Use 'GetInstance' instead")]
         public NestedMessageContent(Asn1Sequence seq)
             : base(seq)
         {
         }
+
+        internal NestedMessageContent(PkiMessages other)
+            : base(other)
+        {
+        }
     }
 }