summary refs log tree commit diff
path: root/crypto/src/tls/ClientHello.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-07-26 21:30:34 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-07-26 21:30:34 +0700
commitb2e186669793e61ec36a50ec35c00f781fa5d3c8 (patch)
tree8bf97cc9d55b35b0cff76e19a94a1cadf3326e70 /crypto/src/tls/ClientHello.cs
parentClientHello 'splitting' to handle PSK binders (diff)
downloadBouncyCastle.NET-ed25519-b2e186669793e61ec36a50ec35c00f781fa5d3c8.tar.xz
More work on PSK binders
Diffstat (limited to 'crypto/src/tls/ClientHello.cs')
-rw-r--r--crypto/src/tls/ClientHello.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crypto/src/tls/ClientHello.cs b/crypto/src/tls/ClientHello.cs
index 50a33ac39..700d424cd 100644
--- a/crypto/src/tls/ClientHello.cs
+++ b/crypto/src/tls/ClientHello.cs
@@ -15,9 +15,10 @@ namespace Org.BouncyCastle.Tls
         private readonly byte[] m_cookie;
         private readonly int[] m_cipherSuites;
         private readonly IDictionary m_extensions;
+        private readonly int m_bindersSize;
 
         public ClientHello(ProtocolVersion version, byte[] random, byte[] sessionID, byte[] cookie,
-            int[] cipherSuites, IDictionary extensions)
+            int[] cipherSuites, IDictionary extensions, int bindersSize)
         {
             this.m_version = version;
             this.m_random = random;
@@ -25,6 +26,12 @@ namespace Org.BouncyCastle.Tls
             this.m_cookie = cookie;
             this.m_cipherSuites = cipherSuites;
             this.m_extensions = extensions;
+            this.m_bindersSize = bindersSize;
+        }
+
+        public int BindersSize
+        {
+            get { return m_bindersSize; }
         }
 
         public int[] CipherSuites
@@ -78,7 +85,7 @@ namespace Org.BouncyCastle.Tls
 
             TlsUtilities.WriteUint8ArrayWithUint8Length(new short[]{ CompressionMethod.cls_null }, output);
 
-            TlsProtocol.WriteExtensions(output, m_extensions);
+            TlsProtocol.WriteExtensions(output, m_extensions, m_bindersSize);
         }
 
         /// <summary>Parse a <see cref="ClientHello"/> from a <see cref="MemoryStream"/>.</summary>
@@ -161,7 +168,7 @@ namespace Org.BouncyCastle.Tls
                 extensions = TlsProtocol.ReadExtensionsDataClientHello(extBytes);
             }
 
-            return new ClientHello(clientVersion, random, sessionID, cookie, cipherSuites, extensions);
+            return new ClientHello(clientVersion, random, sessionID, cookie, cipherSuites, extensions, 0);
         }
     }
 }