summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-03-02 12:42:48 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-03-02 12:42:48 +0700
commit0214aac042c7b9005ab741ab4cf8368637dbace5 (patch)
tree3220088e3858c6a6d78a455aa58fa75d1173b2d2
parentRefactor KeccakDigest (diff)
downloadBouncyCastle.NET-ed25519-0214aac042c7b9005ab741ab4cf8368637dbace5.tar.xz
Add GetLengthOfEncodingIL
-rw-r--r--crypto/src/asn1/Asn1OutputStream.cs5
-rw-r--r--crypto/src/asn1/ConstructedILEncoding.cs4
2 files changed, 6 insertions, 3 deletions
diff --git a/crypto/src/asn1/Asn1OutputStream.cs b/crypto/src/asn1/Asn1OutputStream.cs
index 78cb8e0a8..745674930 100644
--- a/crypto/src/asn1/Asn1OutputStream.cs
+++ b/crypto/src/asn1/Asn1OutputStream.cs
@@ -173,6 +173,11 @@ namespace Org.BouncyCastle.Asn1
             return GetLengthOfIdentifier(tagNo) + GetLengthOfDL(contentsLength) + contentsLength;
         }
 
+        internal static int GetLengthOfEncodingIL(int tagNo, IAsn1Encoding[] contentsEncodings)
+        {
+            return GetLengthOfIdentifier(tagNo) + 3 + GetLengthOfContents(contentsEncodings);
+        }
+
         internal static int GetLengthOfIdentifier(int tagNo)
         {
             if (tagNo < 31)
diff --git a/crypto/src/asn1/ConstructedILEncoding.cs b/crypto/src/asn1/ConstructedILEncoding.cs
index 1934c6f48..a609e1e46 100644
--- a/crypto/src/asn1/ConstructedILEncoding.cs
+++ b/crypto/src/asn1/ConstructedILEncoding.cs
@@ -27,9 +27,7 @@ namespace Org.BouncyCastle.Asn1
 
         int IAsn1Encoding.GetLength()
         {
-            return Asn1OutputStream.GetLengthOfIdentifier(m_tagNo)
-                +  3
-                +  Asn1OutputStream.GetLengthOfContents(m_contentsElements);
+            return Asn1OutputStream.GetLengthOfEncodingIL(m_tagNo, m_contentsElements);
         }
     }
 }