Interface HandshakeState
A HandshakeState object contains a SymmetricState plus the local and remote keys (any of which may be empty), a boolean indicating the initiator or responder role, and the remaining portion of the handshake pattern.
Inherited Members
Namespace: Noise
Assembly: Noise.dll
Syntax
public interface HandshakeState : IDisposable
Properties
| Improve this Doc View SourceRemoteStaticPublicKey
The remote party's static public key.
Declaration
ReadOnlySpan<byte> RemoteStaticPublicKey { get; }
Property Value
Type | Description |
---|---|
System. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown if the current instance has already been disposed. |
Methods
| Improve this Doc View SourceFallback(Protocol, ProtocolConfig)
Converts an Alice-initiated pattern to a Bob-initiated pattern. The only fallback pattern currently supported is XXfallback. PSK modifiers are currently not supported with fallback protocols.
Declaration
void Fallback(Protocol protocol, ProtocolConfig config)
Parameters
Type | Name | Description |
---|---|---|
Protocol | protocol | A concrete Noise protocol (e.g. Noise_XXfallback_25519_AESGCM_BLAKE2b). |
Protocol |
config | A set of parameters used to instantiate a Handshake |
Exceptions
Type | Condition |
---|---|
System. |
Thrown if the current instance has already been disposed. |
System. |
Thrown if either |
System. |
Thrown if |
System. |
Throw if the initial handshake pattern is Bob-initiated, or if this method was not called immediately after the first handshake message. |
ReadMessage(ReadOnlySpan<Byte>, Span<Byte>)
Performs the next step of the handshake,
decrypts the message
,
and writes the result into payloadBuffer
.
The result is undefined if the message
and payloadBuffer
overlap.
Declaration
ReadMessage(ReadOnlySpan<byte> message, Span<byte> payloadBuffer)
Parameters
Type | Name | Description |
---|---|---|
System. |
message | The message to decrypt. |
System. |
payloadBuffer | The buffer for the decrypted payload. |
Returns
Type | Description |
---|---|
System. | The tuple containing the plaintext size in bytes, the handshake hash, and the Transport object for encrypting transport messages. If the handshake is still in progress, the handshake hash and the transport will both be null. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown if the current instance has already been disposed. |
System. |
Thrown if the call to WriteMessage(ReadOnlySpan<Byte>, Span<Byte>) was expected or the handshake has already been completed. |
System. |
Thrown if the message was greater than Max |
System. |
Thrown if the decryption of the message has failed. |
WriteMessage(ReadOnlySpan<Byte>, Span<Byte>)
Performs the next step of the handshake,
encrypts the payload
,
and writes the result into messageBuffer
.
The result is undefined if the payload
and messageBuffer
overlap.
Declaration
WriteMessage(ReadOnlySpan<byte> payload, Span<byte> messageBuffer)
Parameters
Type | Name | Description |
---|---|---|
System. |
payload | The payload to encrypt. |
System. |
messageBuffer | The buffer for the encrypted message. |
Returns
Type | Description |
---|---|
System. | The tuple containing the ciphertext size in bytes, the handshake hash, and the Transport object for encrypting transport messages. If the handshake is still in progress, the handshake hash and the transport will both be null. |
Exceptions
Type | Condition |
---|---|
System. |
Thrown if the current instance has already been disposed. |
System. |
Thrown if the call to ReadMessage(ReadOnlySpan<Byte>, Span<Byte>) was expected or the handshake has already been completed. |
System. |
Thrown if the output was greater than Max |