summary refs log tree commit diff
path: root/crypto/src/asn1/BerSet.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/BerSet.cs')
-rw-r--r--crypto/src/asn1/BerSet.cs25
1 files changed, 12 insertions, 13 deletions
diff --git a/crypto/src/asn1/BerSet.cs b/crypto/src/asn1/BerSet.cs
index 5d61db6aa..2cfda2f09 100644
--- a/crypto/src/asn1/BerSet.cs
+++ b/crypto/src/asn1/BerSet.cs
@@ -14,13 +14,8 @@ namespace Org.BouncyCastle.Asn1
             return elementVector.Count < 1 ? Empty : new BerSet(elementVector);
 		}
 
-        internal static new BerSet FromVector(Asn1EncodableVector elementVector, bool needsSorting)
-		{
-            return elementVector.Count < 1 ? Empty : new BerSet(elementVector, needsSorting);
-		}
-
 		/**
-         * create an empty sequence
+         * create an empty set
          */
         public BerSet()
             : base()
@@ -35,6 +30,11 @@ namespace Org.BouncyCastle.Asn1
         {
         }
 
+        public BerSet(params Asn1Encodable[] elements)
+            : base(elements, false)
+        {
+        }
+
         /**
          * create a set containing a vector of objects.
          */
@@ -43,8 +43,8 @@ namespace Org.BouncyCastle.Asn1
         {
         }
 
-        internal BerSet(Asn1EncodableVector elementVector, bool needsSorting)
-            : base(elementVector, needsSorting)
+        internal BerSet(bool isSorted, Asn1Encodable[] elements)
+            : base(isSorted, elements)
         {
         }
 
@@ -55,14 +55,13 @@ namespace Org.BouncyCastle.Asn1
 
         internal override void Encode(Asn1OutputStream asn1Out, bool withID)
         {
-            if (asn1Out.IsBer)
-            {
-                asn1Out.WriteEncodingIL(withID, Asn1Tags.Constructed | Asn1Tags.Set, elements);
-            }
-            else
+            if (!asn1Out.IsBer)
             {
                 base.Encode(asn1Out, withID);
+                return;
             }
+
+            asn1Out.WriteEncodingIL(withID, Asn1Tags.Constructed | Asn1Tags.Set, elements);
         }
     }
 }