summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Hook <dgh@cryptoworkshop.com>2021-10-07 10:53:59 +1100
committerDavid Hook <dgh@cryptoworkshop.com>2021-10-07 10:53:59 +1100
commit134738b3af06399dc5dacfd9bc97a75e79734f4b (patch)
treecee928a608c92a2b6601685ee5c286c197e1d15a
parentFixes for new_session_ticket (diff)
downloadBouncyCastle.NET-ed25519-134738b3af06399dc5dacfd9bc97a75e79734f4b.tar.xz
corrected DER encoding of SET
-rw-r--r--crypto/src/asn1/Asn1Set.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/asn1/Asn1Set.cs b/crypto/src/asn1/Asn1Set.cs
index 68ede2275..7b3c1ccf3 100644
--- a/crypto/src/asn1/Asn1Set.cs
+++ b/crypto/src/asn1/Asn1Set.cs
@@ -285,6 +285,24 @@ namespace Org.BouncyCastle.Asn1
 #endif
         }
 
+		public override byte[] GetEncoded(
+			string encoding)
+		{
+			if (encoding.Equals(Der))
+			{
+                this.Sort();
+                
+				MemoryStream bOut = new MemoryStream();
+				DerOutputStream dOut = new DerOutputStream(bOut);
+
+				dOut.WriteObject(this);
+
+				return bOut.ToArray();
+			}
+
+			return GetEncoded();
+		}
+
         public override string ToString()
         {
             return CollectionUtilities.ToString(elements);