-
Notifications
You must be signed in to change notification settings - Fork 0
DiscoNet.Noise
Fasjeit edited this page Aug 17, 2018
·
2 revisions
Asymmetric suite
public class DiscoNet.Noise.Asymmetric
Static Fields
Type | Name | Summary |
---|---|---|
Int32 |
DhLen | A constant specifying the size in bytes of public keys and DH outputs. |
Static Methods
Type | Name | Summary |
---|---|---|
Byte[] |
Dh(KeyPair keyPair, Byte[] publicKey) |
Perform DH on public key |
KeyPair |
GenerateKeyPair(Byte[] privateKey = null) |
Create a X25519 static keyPair out of a private key. |
Noise handshake state
public class DiscoNet.Noise.HandshakeState
: IDisposable
Properties
Type | Name | Summary |
---|---|---|
KeyPair |
E | The local ephemeral key pair |
Boolean |
Initiator | Indicating the initiator or responder role. |
MessagePattern[] |
MessagePatterns | A sequence of message pattern. Each message pattern is a sequence of tokens from the set ("e", "s", "ee", "es", "se", "ss") |
Byte[] |
Psk | Pre-shared key |
KeyPair |
Re | The remote party's ephemeral public key |
KeyPair |
Rs | The remote party's static public key |
KeyPair |
S | The local static key pair |
Boolean |
ShouldWrite | indicating if the role of the peer is to WriteMessage or ReadMessage |
SymmetricState |
SymmetricState | SymmetricState object |
Methods
Type | Name | Summary |
---|---|---|
void |
Dispose() | Dispose and freeresourses |
ValueTuple<Strobe, Strobe> |
ReadMessage(Byte[] message, Byte[]& payloadBuffer) |
Read handshake message and output payload |
Strobe hash object
public class DiscoNet.Noise.Hash
: ICloneable
Methods
Type | Name | Summary |
---|---|---|
Object |
Clone() | Get copy of the DiscoHash in its current state. |
Byte[] |
Sum() | Reads more output from the hash; reading affects the hash's state |
Int32 |
Write(Byte[] inputData) |
Write absorbs more data into the hash's state. This function is usually called to hash contigous chunks of data. For structured data please refer to WriteTuple |
Int32 |
WriteTuple(Byte[] inputData) |
Absorbs more data to hash in a non-ambigious way. This means that data absorbed via this function is separated from the data surrounding it. Use this function instead of Write to hash structured data. |
Symmectic suite
public static class DiscoNet.Noise.Symmetric
Static Fields
Type | Name | Summary |
---|---|---|
Int32 |
HashSize | Hash size, bytes |
Int32 |
KeySize | Symmetric key size, bytes |
Int32 |
MinimumCiphertextSize | Minimum size of ciphertexts, bytes |
Int32 |
NonceSize | Nonce size, bytes |
Int32 |
PskKeySize | Pre shared key size, bytes |
Int32 |
SecurityParameter | Symmetric security parameter, bits |
Int32 |
TagSize | Tag size, bytes |
Static Methods
Type | Name | Summary |
---|---|---|
Byte[] |
Decrypt(Byte[] key, Byte[] ciphertext) |
Decrypt a message and check integrity |
Byte[] |
DeriveKeys(Byte[] keyMaterial, Int32 keyLen) |
Derive key data |
Byte[] |
Encrypt(Byte[] key, Byte[] plaintext) |
Encrypt a plaintext message with a key of any size greater than 128 bits (16 bytes). |
Byte[] |
Hash(Byte[] input, Int32 outputLength) |
Hash allows you to hash an input of any length and obtain an output of length greater or equal to 256 bits (32 bytes). |
Byte[] |
ProtectIntegrity(Byte[] key, Byte[] plaintext) |
Protect integrity of unecrypted text |
Byte[] |
VerifyIntegrity(Byte[] key, Byte[] plaintextAndTag) |
Retrieve and Verify plaintext from unencrypted message |
Noise symmetric state
public class DiscoNet.Noise.SymmetricState
Properties
Type | Name | Summary |
---|---|---|
Boolean |
IsKeyed | Is state keyed |