Class Psk1Protector
Provides access to a private network of peers that uses a PreSharedKey.
Implements
Inherited Members
Namespace: PeerTalk.SecureCommunication
Assembly: PeerTalk.dll
Syntax
public class Psk1Protector : INetworkProtector
Remarks
The Swarm calls the network protector whenever a connection is being established with another peer.
Properties
| Improve this Doc View SourceKey
The key of the private network.
Declaration
public PreSharedKey Key { set; }
Property Value
Type | Description |
---|---|
PreSharedKey | Only peers with this key can be communicated with. |
Methods
| Improve this Doc View SourceProtectAsync(PeerConnection, CancellationToken)
Creates a protected stream for the connection.
Declaration
public Task<Stream> ProtectAsync(PeerConnection connection, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
PeerConnection | connection | A connection between two peers. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<Stream> | A task that represents the asynchronous operation. The task's result is the protected stream. |
Remarks
ProtectAsync is called after the transport level has established the connection.
An exception is thrown if the remote peer is not a member of the private network.