Interface Transport
A pair of CipherState objects for encrypting transport messages.
Inherited Members
Namespace: Noise
Assembly: Noise.dll
Syntax
public interface Transport : IDisposable
Properties
| Improve this Doc View SourceIsOneWay
Gets a value indicating whether the Transport is one-way.
Declaration
bool IsOneWay { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the Transport is one-way, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | Thrown if the current instance has already been disposed. |
Methods
| Improve this Doc View SourceReadMessage(ReadOnlySpan<Byte>, Span<Byte>)
Decrypts the message
and writes the result into payloadBuffer
.
Declaration
int ReadMessage(ReadOnlySpan<byte> message, Span<byte> payloadBuffer)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<System.Byte> | message | The message to decrypt. |
System.Span<System.Byte> | payloadBuffer | The buffer for the decrypted payload. |
Returns
Type | Description |
---|---|
System.Int32 | The plaintext size in bytes. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | Thrown if the current instance has already been disposed. |
System.InvalidOperationException | Thrown if the initiator has attempted to read a message from a one-way stream. |
System.ArgumentException | Thrown if the message was greater than MaxMessageLength bytes in length, or if the output buffer did not have enough space to hold the plaintext. |
System.Security.Cryptography.CryptographicException | Thrown if the decryption of the message has failed. |
RekeyInitiatorToResponder()
Updates the symmetric key used to encrypt transport messages from initiator to responder using a one-way function, so that a compromise of keys will not decrypt older messages.
Declaration
void RekeyInitiatorToResponder()
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | Thrown if the current instance has already been disposed. |
RekeyResponderToInitiator()
Updates the symmetric key used to encrypt transport messages from responder to initiator using a one-way function, so that a compromise of keys will not decrypt older messages.
Declaration
void RekeyResponderToInitiator()
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | Thrown if the current instance has already been disposed. |
System.InvalidOperationException | Thrown if the current instance is a one-way stream. |
WriteMessage(ReadOnlySpan<Byte>, Span<Byte>)
Encrypts the payload
and writes the result into messageBuffer
.
Declaration
int WriteMessage(ReadOnlySpan<byte> payload, Span<byte> messageBuffer)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<System.Byte> | payload | The payload to encrypt. |
System.Span<System.Byte> | messageBuffer | The buffer for the encrypted message. |
Returns
Type | Description |
---|---|
System.Int32 | The ciphertext size in bytes. |
Exceptions
Type | Condition |
---|---|
System.ObjectDisposedException | Thrown if the current instance has already been disposed. |
System.InvalidOperationException | Thrown if the responder has attempted to write a message to a one-way stream. |
System.ArgumentException | Thrown if the encrypted payload was greater than MaxMessageLength bytes in length, or if the output buffer did not have enough space to hold the ciphertext. |