summary refs log tree commit diff
path: root/crypto/src/tls/OfferedPsks.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/tls/OfferedPsks.cs')
-rw-r--r--crypto/src/tls/OfferedPsks.cs36
1 files changed, 26 insertions, 10 deletions
diff --git a/crypto/src/tls/OfferedPsks.cs b/crypto/src/tls/OfferedPsks.cs
index 9eddd2e23..1cc8a2a68 100644
--- a/crypto/src/tls/OfferedPsks.cs
+++ b/crypto/src/tls/OfferedPsks.cs
@@ -26,6 +26,22 @@ namespace Org.BouncyCastle.Tls
             }
         }
 
+        internal class SelectedConfig
+        {
+            internal readonly int m_index;
+            internal readonly TlsPsk m_psk;
+            internal readonly short[] m_pskKeyExchangeModes;
+            internal readonly TlsSecret m_earlySecret;
+
+            internal SelectedConfig(int index, TlsPsk psk, short[] pskKeyExchangeModes, TlsSecret earlySecret)
+            {
+                this.m_index = index;
+                this.m_psk = psk;
+                this.m_pskKeyExchangeModes = pskKeyExchangeModes;
+                this.m_earlySecret = earlySecret;
+            }
+        }
+
         private readonly IList m_identities;
         private readonly IList m_binders;
         private readonly int m_bindersSize;
@@ -49,16 +65,6 @@ namespace Org.BouncyCastle.Tls
             this.m_bindersSize = bindersSize;
         }
 
-        internal byte[] GetBinderForIdentity(PskIdentity matchIdentity)
-        {
-            for (int i = 0, count = m_identities.Count; i < count; ++i)
-            {
-                if (matchIdentity.Equals(m_identities[i]))
-                    return (byte[])m_binders[i];
-            }
-            return null;
-        }
-
         public IList Binders
         {
             get { return m_binders; }
@@ -74,6 +80,16 @@ namespace Org.BouncyCastle.Tls
             get { return m_identities; }
         }
 
+        public int GetIndexOfIdentity(PskIdentity pskIdentity)
+        {
+            for (int i = 0, count = m_identities.Count; i < count; ++i)
+            {
+                if (pskIdentity.Equals(m_identities[i]))
+                    return i;
+            }
+            return -1;
+        }
+
         /// <exception cref="IOException"/>
         public void Encode(Stream output)
         {