Class CryptoECDH
Implements Elliptic Curve Diffie Hellman key exchange.
Inheritance
System.Object
CryptoECDH
Namespace: SuperNet.Netcode.Crypto
Assembly: cs.temp.dll.dll
Syntax
public sealed class CryptoECDH : ICryptoExchanger, IDisposable
Constructors
CryptoECDH(ICryptoRandom, Allocator)
Create a new ECDH key pair for key exchange.
Declaration
public CryptoECDH(ICryptoRandom random, Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
ICryptoRandom | random | Random number generator to use for generating keys. |
Allocator | allocator | Allocator to use for allocating keys. |
Fields
KeyLength
Size of exchange key in bytes. For ECDH this is 32.
Declaration
public const int KeyLength = 32
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
DeriveEncryptor(ArraySegment<Byte>)
Generate a shared encryptor.
Declaration
public ICryptoEncryptor DeriveEncryptor(ArraySegment<byte> remoteKey)
Parameters
Type | Name | Description |
---|---|---|
ArraySegment<System.Byte> | remoteKey | Received remote exchange key. |
Returns
Type | Description |
---|---|
ICryptoEncryptor | Shared encryptor that is guaranteed to be the same on both peers. |
Dispose()
Returns key pair back to the allocator.
Declaration
public void Dispose()
ExportKey(ArraySegment<Byte>)
Copy exchange key to the output.
Declaration
public void ExportKey(ArraySegment<byte> output)
Parameters
Type | Name | Description |
---|---|---|
ArraySegment<System.Byte> | output | Output to write to. |
Explicit Interface Implementations
ICryptoExchanger.KeyLength
Size of exchange key in bytes. For ECDH this is 32.
Declaration
int ICryptoExchanger.KeyLength { get; }
Returns
Type | Description |
---|---|
System.Int32 |
Implements
IDisposable