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.
struct SshExchangeTranscript
Types 1
structSshExchangeTranscript
Inputs to the exchange-hash transcript.
Fields
const(char)[] clientIdentificationconst(char)[] serverIdentificationconst(ubyte)[] clientKexInitconst(ubyte)[] serverKexInitconst(ubyte)[] hostKeyBlobconst(ubyte)[] clientPublicconst(ubyte)[] serverPublicconst(ubyte)[] sharedSecretFunctions 9
fn
ubyte[32] computeExchangeHash(scope const SshExchangeTranscript transcript)Computes the exchange hash for curve25519-sha256.fn
ubyte[] 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.fn
ubyte[] 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 fn
SshExchangeTranscript referenceTranscript() @safeBuilds the reference transcript used by the vector tests.Variables 2
private var
ubyte[32] expectedHashprivate var
string expectedEncodedHex = "0000002065666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f8081828384"