ddn.net.ssh.kex_curve

Curve25519 key exchange math: the exchange hash and the SSH key derivation function (RFC 4253 section 7.2, RFC 8731).

All functions are pure computations over supplied values; the message flow that produces the inputs lives in the session's key-exchange phase.

Types 1

Inputs to the exchange-hash transcript.

Fields
const(char)[] clientIdentification
const(char)[] serverIdentification
const(ubyte)[] clientKexInit
const(ubyte)[] serverKexInit
const(ubyte)[] hostKeyBlob
const(ubyte)[] clientPublic
const(ubyte)[] serverPublic
const(ubyte)[] sharedSecret

Functions 9

fnubyte[32] computeExchangeHash(scope const SshExchangeTranscript transcript)Computes the exchange hash for curve25519-sha256.
fnubyte[] deriveKey(const(ubyte)[] sharedSecretMpint, in ubyte[32] exchangeHash, in ubyte[32] sessionId, char letterOne, size_t length)Derives directional key material with the SSH KDF.
fnubyte[] sharedSecretEncoded(scope const(ubyte)[] sharedSecretRaw)Encodes the shared secret for hashing exactly as deployed implementations do: canonical mpint encoding of the raw output bytes unchanged (see computeExchangeHash for the RFC 8731 note).
private fnvoid hashString(SHA256Digest hash, scope const(ubyte)[] data)
private fnvoid hashString(SHA256Digest hash, scope const(char)[] text)
private fnSshExchangeTranscript referenceTranscript() @safeBuilds the reference transcript used by the vector tests.
private fnconst(ubyte)[] hexBytes(string hex) @safe
private fnuint fromHex(char hi, char lo) @safe pure
private fnstring toHexOf(scope const(ubyte)[] data) @safe

Variables 2

private varubyte[32] expectedHash
private varstring expectedEncodedHex = "0000002065666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f8081828384"