summary refs log tree commit diff
path: root/crypto/src/asn1/BerOctetString.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-03-11 14:55:17 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-03-11 14:55:17 +0700
commit806a62d3d17c9f7b34315b11c6f99de192ed9e33 (patch)
tree7c34006c1fb880355953281ce23c0722391530bc /crypto/src/asn1/BerOctetString.cs
parentNUnit3TestAdapter 4.4.2 (diff)
downloadBouncyCastle.NET-ed25519-806a62d3d17c9f7b34315b11c6f99de192ed9e33.tar.xz
Obsolete unused segmentLimit
Diffstat (limited to '')
-rw-r--r--crypto/src/asn1/BerOctetString.cs24
1 files changed, 8 insertions, 16 deletions
diff --git a/crypto/src/asn1/BerOctetString.cs b/crypto/src/asn1/BerOctetString.cs
index 5350b8416..10d8d6db6 100644
--- a/crypto/src/asn1/BerOctetString.cs
+++ b/crypto/src/asn1/BerOctetString.cs
@@ -6,17 +6,9 @@ namespace Org.BouncyCastle.Asn1
     public class BerOctetString
         : DerOctetString
     {
-        private const int DefaultSegmentLimit = 1000;
-
         public static BerOctetString FromSequence(Asn1Sequence seq)
         {
-            int count = seq.Count;
-            Asn1OctetString[] v = new Asn1OctetString[count];
-            for (int i = 0; i < count; ++i)
-            {
-                v[i] = GetInstance(seq[i]);
-            }
-            return new BerOctetString(v);
+            return new BerOctetString(seq.MapElements(GetInstance));
         }
 
         internal static byte[] FlattenOctetStrings(Asn1OctetString[] octetStrings)
@@ -51,34 +43,34 @@ namespace Org.BouncyCastle.Asn1
             }
         }
 
-        private readonly int segmentLimit;
         private readonly Asn1OctetString[] elements;
 
         public BerOctetString(byte[] contents)
-			: this(contents, DefaultSegmentLimit)
+			: this(contents, null)
 		{
 		}
 
         public BerOctetString(Asn1OctetString[] elements)
-            : this(elements, DefaultSegmentLimit)
+            : this(FlattenOctetStrings(elements), elements)
         {
         }
 
+        [Obsolete("Use version without segmentLimit (which is ignored anyway)")]
         public BerOctetString(byte[] contents, int segmentLimit)
-            : this(contents, null, segmentLimit)
+            : this(contents)
         {
         }
 
+        [Obsolete("Use version without segmentLimit (which is ignored anyway)")]
         public BerOctetString(Asn1OctetString[] elements, int segmentLimit)
-            : this(FlattenOctetStrings(elements), elements, segmentLimit)
+            : this(elements)
         {
         }
 
-        private BerOctetString(byte[] contents, Asn1OctetString[] elements, int segmentLimit)
+        private BerOctetString(byte[] contents, Asn1OctetString[] elements)
             : base(contents)
         {
             this.elements = elements;
-            this.segmentLimit = segmentLimit;
         }
 
         internal override IAsn1Encoding GetEncoding(int encoding)