From 8d2a2cd5de40e2b94ef5007c32832ed9a063dc40 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Thu, 12 Oct 2023 22:09:49 +0800 Subject: +hazel-networking --- .../Hazel/Dtls/IHandshakeCipherSuite.cs | 63 ++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs (limited to 'Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs') diff --git a/Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs b/Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs new file mode 100644 index 0000000..eedd977 --- /dev/null +++ b/Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs @@ -0,0 +1,63 @@ +using System; + +namespace Hazel.Dtls +{ + /// + /// DTLS cipher suite interface for the handshake portion of + /// the connection. + /// + public interface IHandshakeCipherSuite : IDisposable + { + /// + /// Gets the size of the shared key + /// + /// Size of the shared key in bytes + int SharedKeySize(); + + /// + /// Calculate the size of the ServerKeyExchnage message + /// + /// + /// Private key that will be used to sign the message + /// + /// Size of the message in bytes + int CalculateServerMessageSize(object privateKey); + + /// + /// Encodes the ServerKeyExchange message + /// + /// Private key to use for signing + void EncodeServerKeyExchangeMessage(ByteSpan output, object privateKey); + + /// + /// Verifies the authenticity of a server key exchange + /// message and calculates the shared secret. + /// + /// + /// True if the authenticity has been validated and a shared key + /// was generated. Otherwise, false. + /// + bool VerifyServerMessageAndGenerateSharedKey(ByteSpan output, ByteSpan serverKeyExchangeMessage, object publicKey); + + /// + /// Calculate the size of the ClientKeyExchange message + /// + /// Size of the message in bytes + int CalculateClientMessageSize(); + + /// + /// Encodes the ClientKeyExchangeMessage + /// + void EncodeClientKeyExchangeMessage(ByteSpan output); + + /// + /// Verifies the validity of a client key exchange message + /// and calculats the hsared secret. + /// + /// + /// True if the client exchange message is valid and a + /// shared key was generated. Otherwise, false. + /// + bool VerifyClientMessageAndGenerateSharedKey(ByteSpan output, ByteSpan clientKeyExchangeMessage); + } +} -- cgit v1.1-26-g67d0