diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-17 00:40:40 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-10-17 00:40:40 +0700 |
commit | ae8243b18d515b4942e41989b5d78fd05026ccd3 (patch) | |
tree | 5ee2bea0d14234e008b929d20751edde34716325 /crypto/src/tls/PskIdentity.cs | |
parent | BiString updates from bc-java (diff) | |
download | BouncyCastle.NET-ed25519-ae8243b18d515b4942e41989b5d78fd05026ccd3.tar.xz |
TLS 1.3 PSK server-side work
Diffstat (limited to 'crypto/src/tls/PskIdentity.cs')
-rw-r--r-- | crypto/src/tls/PskIdentity.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crypto/src/tls/PskIdentity.cs b/crypto/src/tls/PskIdentity.cs index 082907419..1887d0af4 100644 --- a/crypto/src/tls/PskIdentity.cs +++ b/crypto/src/tls/PskIdentity.cs @@ -1,6 +1,8 @@ using System; using System.IO; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Tls { public sealed class PskIdentity @@ -48,5 +50,20 @@ namespace Org.BouncyCastle.Tls long obfuscatedTicketAge = TlsUtilities.ReadUint32(input); return new PskIdentity(identity, obfuscatedTicketAge); } + + public override bool Equals(object obj) + { + PskIdentity that = obj as PskIdentity; + if (null == that) + return false; + + return this.m_obfuscatedTicketAge == that.m_obfuscatedTicketAge + && Arrays.ConstantTimeAreEqual(this.m_identity, that.m_identity); + } + + public override int GetHashCode() + { + return Arrays.GetHashCode(m_identity) ^ m_obfuscatedTicketAge.GetHashCode(); + } } } |