diff options
author | chai <215380520@qq.com> | 2023-10-12 22:09:49 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-10-12 22:09:49 +0800 |
commit | 8d2a2cd5de40e2b94ef5007c32832ed9a063dc40 (patch) | |
tree | a63dfbe815855925c9fb8f2804bd6ccfeffbd2eb /Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs | |
parent | dd0c5d50e377d9be1e728463670908a6c9d2c14f (diff) |
+hazel-networking
Diffstat (limited to 'Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs')
-rw-r--r-- | Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs | 63 |
1 files changed, 63 insertions, 0 deletions
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 +{ + /// <summary> + /// DTLS cipher suite interface for the handshake portion of + /// the connection. + /// </summary> + public interface IHandshakeCipherSuite : IDisposable + { + /// <summary> + /// Gets the size of the shared key + /// </summary> + /// <returns>Size of the shared key in bytes </returns> + int SharedKeySize(); + + /// <summary> + /// Calculate the size of the ServerKeyExchnage message + /// </summary> + /// <param name="privateKey"> + /// Private key that will be used to sign the message + /// </param> + /// <returns>Size of the message in bytes</returns> + int CalculateServerMessageSize(object privateKey); + + /// <summary> + /// Encodes the ServerKeyExchange message + /// </summary> + /// <param name="privateKey">Private key to use for signing</param> + void EncodeServerKeyExchangeMessage(ByteSpan output, object privateKey); + + /// <summary> + /// Verifies the authenticity of a server key exchange + /// message and calculates the shared secret. + /// </summary> + /// <returns> + /// True if the authenticity has been validated and a shared key + /// was generated. Otherwise, false. + /// </returns> + bool VerifyServerMessageAndGenerateSharedKey(ByteSpan output, ByteSpan serverKeyExchangeMessage, object publicKey); + + /// <summary> + /// Calculate the size of the ClientKeyExchange message + /// </summary> + /// <returns>Size of the message in bytes</returns> + int CalculateClientMessageSize(); + + /// <summary> + /// Encodes the ClientKeyExchangeMessage + /// </summary> + void EncodeClientKeyExchangeMessage(ByteSpan output); + + /// <summary> + /// Verifies the validity of a client key exchange message + /// and calculats the hsared secret. + /// </summary> + /// <returns> + /// True if the client exchange message is valid and a + /// shared key was generated. Otherwise, false. + /// </returns> + bool VerifyClientMessageAndGenerateSharedKey(ByteSpan output, ByteSpan clientKeyExchangeMessage); + } +} |