aboutsummaryrefslogtreecommitdiff
path: root/Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2023-10-12 22:09:49 +0800
committerchai <215380520@qq.com>2023-10-12 22:09:49 +0800
commit8d2a2cd5de40e2b94ef5007c32832ed9a063dc40 (patch)
treea63dfbe815855925c9fb8f2804bd6ccfeffbd2eb /Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs
parentdd0c5d50e377d9be1e728463670908a6c9d2c14f (diff)
+hazel-networking
Diffstat (limited to 'Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs')
-rw-r--r--Tools/Hazel-Networking/Hazel/Dtls/IHandshakeCipherSuite.cs63
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);
+ }
+}