From: Matthew Endsley Date: Sat, 19 Dec 2020 02:21:34 +0000 (-0800) Subject: Add initial cipher suite interfaces X-Git-Tag: 1.0.0~20^2~27^2~1 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=56c0cf45c00b72e46248205a2f869bc5c060534d;p=rhonda%2Fimpostor.hazel.git Add initial cipher suite interfaces --- diff --git a/Hazel/Dtls/IHandshakeCipherSuite.cs b/Hazel/Dtls/IHandshakeCipherSuite.cs new file mode 100644 index 0000000..4428e85 --- /dev/null +++ b/Hazel/Dtls/IHandshakeCipherSuite.cs @@ -0,0 +1,60 @@ +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 + /// + /// Size of the message in bytes + int CalculateServerMessageSize(); + + /// + /// 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); + } +} diff --git a/Hazel/Hazel.csproj b/Hazel/Hazel.csproj index f938a8d..ac4ed51 100644 --- a/Hazel/Hazel.csproj +++ b/Hazel/Hazel.csproj @@ -78,6 +78,7 @@ +