Open Charging Technology · Whitepapers

White Paper

NTS Key Establishment over SSH

This white paper proposes to run the Network Time Security Key Establishment (NTS-KE) protocol as a Secure Shell (SSH) subsystem. It addresses the managed networks of Charge Point Operators (CPOs), laboratories, test sites and other private infrastructures that want authenticated time, but run no X.509 PKI of their own. The paper describes:

Status: this is a draft for discussion. The NTS-KE server and client of Vanaheimr Norn implement both options of key binding, on the SSH stack of Vanaheimr Hermod; section 8.1 says what is implemented so far. The subsystem name, the record type and the device model variables are provisional. The record of section 5 is specified on its own in nts-ke-ssh-key-binding.md, for the registration of its record type with IANA (IANA-registration.md).

1. Motivation

In private networks NTS rarely fails because of its cryptography, but often because of the PKI it needs. RFC 8915 requires NTS-KE to run over TLS 1.3 with a server certificate the client can validate, and this has three practical consequences:

SSH, on the other hand, is present on almost every networked device and in every operator's toolbox. An SSH host key is a bare public key without a validity period: it is pinned, signed by a lightweight SSH certificate authority, or published in the DNS. Client authentication with public keys is the normal case, not the exception.

The goal is a second transport for the same NTS-KE logic, not a replacement of RFC 8915 on the public Internet (section 4.1 of Critical Legal Time Services). It is meant for the managed networks with trust zones of section 4.2 of that paper.

2. Background: NTS-KE according to RFC 8915

Section 2.1 of the Secure Time Synchronization white paper describes the NTS-KE phase in detail. Five of its properties matter here:

  1. Transport: TCP port 4460, TLS 1.3, ALPN ntske/1. Exactly one request and one response per TLS connection; afterwards the server closes the connection and discards all state.
  2. Records: a 16-bit type with a critical bit, a 16-bit body length, and the body. Records delimit themselves and can therefore be carried over any reliable byte stream.
  3. Keys: the client-to-server (C2S) and server-to-client (S2C) keys are taken from the TLS exporter (RFC 9846, section 7.5, formerly RFC 8446) with the label EXPORTER-network-time-security and a context of five octets: the protocol id 0x0000 of NTPv4, the id of the negotiated AEAD algorithm, and 0x00 for C2S or 0x01 for S2C.
  4. Cookies: the server encrypts C2S, S2C and the AEAD algorithm id with a master key into opaque cookies. The NTP server needs this master key, but no TLS state.
  5. Decoupling: the NTS extension fields of NTPv4 depend on cookies and keys only. Where the keys came from does not matter to the NTP server.

Property 5 is the foundation of this paper: only the channel of property 1 and the source of the keys of property 3 are replaced.

3. Protocol Overview

3.1 Subsystem Name and Versioning

The subsystem name is ntske/1@open.charging.cloud. It mirrors the ALPN token ntske/1 and carries the version in its local part.

Rejected alternatives:

3.2 Message Flow

One NTS-KE exchange over SSH runs through four phases. Only phase 3 carries NTS-KE, and within it only the SSH Key Binding record (section 5) is new. The flow shows the primary profile of section 8.1, an NTS-KE server with an SSH listener of its own, with option A of section 4.

sequenceDiagram
    participant C as Client (charging station)
    participant K as NTS-KE server with SSH listener
    participant N as NTP server

    Note over C,K: 1. SSH transport
    C->>K: version string, KEXINIT (strict KEX)
    K->>C: version string, KEXINIT (strict KEX)
    C->>K: KEX_ECDH_INIT (e.g. mlkem768x25519-sha256)
    K->>C: KEX_ECDH_REPLY (host key, signature over H)
    Note over C: verify the host key against a pin or an SSH CA
    Note over C,K: both compute exporter_secret from K and H (option A)
    C->>K: NEWKEYS
    K->>C: NEWKEYS

    Note over C,K: 2. Authentication and channel
    C->>K: USERAUTH_REQUEST publickey, user "ntske"
    K->>C: USERAUTH_SUCCESS
    C->>K: CHANNEL_OPEN "session"
    K->>C: CHANNEL_OPEN_CONFIRMATION
    C->>K: CHANNEL_REQUEST "subsystem" ntske/1@open.charging.cloud
    K->>C: CHANNEL_SUCCESS

    Note over C,K: 3. NTS-KE inside the subsystem
    C->>K: Next Protocol, AEAD, SSH Key Binding (0x0001, 0x0002), End of Message
    Note over K: choose exporter_nonce, derive C2S/S2C from the SSH exporter and the nonce, encrypt the cookies
    K->>C: Next Protocol, AEAD, SSH Key Binding (0x0001, exporter_nonce), 8 × New Cookie, End of Message
    Note over C: derive C2S/S2C from the SSH exporter and the nonce
    K->>C: CHANNEL_REQUEST "exit-status" 0, CHANNEL_EOF, CHANNEL_CLOSE

    Note over C,N: 4. NTS-protected NTP, unchanged (UDP port 123)
    C->>N: NTPv4 request with NTS extension fields
    N->>C: NTPv4 response with NTS extension fields and a new cookie

4. Key Binding

An SSH keying material exporter can be defined cleanly, but the security of NTS-KE over SSH does not depend on it. Both options below end in the same key derivation function; only its pseudorandom key differs.

4.1 Why RFC 8915 Uses an Exporter

The TLS exporter yields C2S and S2C without sending any key over the wire. Both peers contribute to the result through the (EC)DH exchange, and the keys are bound to exactly this TLS connection.

Channel binding in the strict sense protects against a relaying attacker when authentication and the channel live in different layers. With NTS-KE both live in TLS. There the exporter is an elegant design, but not the only line of defence.

4.2 Why the SSH Session Identifier Is Not Key Material

SSH offers a natural candidate: the session identifier, i.e. the exchange hash H of the first key exchange. It is signed in public key user authentication, it is used by the session-bind@openssh.com extension of the OpenSSH agent protocol, and an expired draft from 2007 proposed it as the channel binding of SSH (draft-williams-sshv2-channel-bindings).

A channel binding value, however, is not a secret. The session identifier is handed to the SSH agent, possibly via agent forwarding to other hosts, and it shows up in debug output. A key derived from it alone would be only as secret as its least careful holder. The session identifier must never be the only input of key material.

4.3 Option A: SSH Keying Material Exporter

The secret known only to both endpoints is the shared secret K of the key exchange. An exporter must therefore depend on K, just like the key derivation of RFC 4253, section 7.2. A nonce, which the server sends with every exchange, keeps the keys of one exchange apart from those of the next on the same connection:

exporter_secret = HASH( K || H || string("ssh-exporter@open.charging.cloud") || session_id )

PRK = HKDF-Extract( salt = exporter_nonce,
                    IKM  = exporter_secret )   # HMAC with HASH

SSH-Exporter(label, context, L) =
    HKDF-Expand( PRK  = PRK,
                 info = string(label) || string(context),
                 L    = L )                    # HMAC with HASH

4.4 Option B: In-Band Key Transport

For every exchange the server generates a fresh 32-byte secret nts_ke_secret and sends it in the SSH Key Binding record of section 5. Both peers derive the keys from it with the same function:

NTS-Exporter(label, context, L) =
    HKDF-Expand-SHA256( PRK  = nts_ke_secret,
                        info = string(label) || string(context),
                        L    = L )

Label and context are those of RFC 8915. Option B thus differs from option A only in its PRK, which the server sends instead of both peers extracting it from the connection, and an implementation needs a single function Exporter(label, context, L) with three interchangeable sources: TLS, the SSH exporter, and the transported secret. Appendix A gives test vectors.

Security argument: the secret travels in the same SSH channel whose endpoint the client has authenticated through its host key. Whoever can read the secret can also read and forge the records and cookies, and has therefore broken SSH itself. Then option A fails as well. The gap between layers that channel binding protects against does not exist here.

Drawbacks: the secret is visible in plain text on the local pipe between the SSH server and the subsystem process, i.e. within the same trust domain. The keys depend on the random number generator of the server only, which generates the cookies anyway and loses nothing.

4.5 Comparison and Recommendation

Criterion A: SSH exporter B: In-band transport
Keys on the wire never encrypted inside the SSH channel
Contribution of both peers yes, through K no, server randomness only
Binding to the SSH connection cryptographic implicit, through the channel
NTS-KE server with SSH listener small addition to the KEX no change
Unmodified OpenSSH server no, needs a patch yes
Off-the-shelf SSH client library rarely exposes K and H yes
Several exchanges per connection allowed, with a nonce each allowed, with a secret each
Key binding record in the response 38 bytes, with the nonce 38 bytes, with the secret
New specifications SSH exporter and record record only

Recommendation: option A is preferred wherever both ends terminate SSH themselves, as the NTS-KE server with an SSH listener of section 8.1 and a client on the same SSH stack do. Option B is mandatory to implement nevertheless: it is the common ground for clients with off-the-shelf SSH libraries and for servers behind an unmodified OpenSSH server. The record of section 5 negotiates between both. The SSH exporter itself should be specified independently of NTS, as it would be useful for other protocols over SSH as well. The white paper SSH Keying Material Exporter does so, and compares it with the exporter of TLS 1.3.

5. The SSH Key Binding Record

A single new NTS-KE record negotiates the source of the keys and carries the nonce of option A or the secret of option B. All other records remain as defined by RFC 8915. The record is specified on its own as well, for the registration of its record type with IANA: nts-ke-ssh-key-binding.md.

Field Value
Name SSH Key Binding
Record type 16386 (provisional), from the Private or Experimental Use range 16384 … 32767 of the NTS-KE record type registry
Critical bit set; the subsystem name implies that the server knows the record
Body of the request one entry per method offered, in order of preference: a 16-bit method id, a 16-bit data length and that many bytes of data for the method
Body of the response one 16-bit method id, followed by method-specific data
Method 0x0001 Exporter (option A), 32 bytes exporter_nonce
Method 0x0002 Transport (option B), 32 bytes nts_ke_secret

Example: the client could use the exporter, but the server runs behind an unmodified OpenSSH server and selects the transport.

Client → Server
  NTS Next Protocol Negotiation  [C]  0x0000 (NTPv4)
  AEAD Algorithm Negotiation          15, 30
  SSH Key Binding                [C]  0x0001 (no data), 0x0002 (no data)
  End of Message                 [C]

Server → Client
  NTS Next Protocol Negotiation  [C]  0x0000
  AEAD Algorithm Negotiation          15
  SSH Key Binding                [C]  0x0002 || nts_ke_secret (32 bytes)
  New Cookie for NTPv4                × 8
  End of Message                 [C]

6. Authentication and Trust Anchors

The security of the whole mechanism stands and falls with the verification of the server's host key. A client must never accept an unknown host key silently.

6.1 Server Authentication

Mechanism Trust anchor Needs a correct clock Suitable for
Pinned host key fingerprint in the client configuration, e.g. SSHHostKeyPins (section 7) no few servers, devices without a real-time clock
SSH host certificate one CA key (@cert-authority), signed with ssh-keygen -s only with a limited validity; -V always:forever is possible many servers, key rotation without touching the clients
SSHFP record in the DNS DNSSEC (RFC 4255, RFC 6594, RFC 7479) yes, for the validity of the RRSIG records networks with a DNSSEC infrastructure
Trust on first use the first contact no laboratories only, never in operation

For devices without a battery-backed real-time clock, the pinned host key and the host certificate without an expiry date are the only mechanisms without a bootstrapping problem. SSH certificates with a limited validity raise the same question as X.509 certificates.

6.2 Client Authentication and Authorization

What the client identity brings:

7. Mapping onto the OCPP v2.x Device Model (Proposal)

The NTP Client Controller of section 3.2.4 of the Secure Time Synchronization white paper gets a fourth value of its variable Mode: NTSv4SSH. In this mode ServerURL names the SSH server that offers the NTS-KE subsystem. NTSKEServerPort, RootCAs, CertificatePins, RootPins, NoCertTimeCheckAfterReboot and CertificateFingerprint do not apply, and the following variables are added:

Variable Name req/opt Mutability Data Type Default Value Values List / Limits Description
SSHPort optional rw integer 22 1 … 65535 The SSH port of the NTS-KE server in mode NTSv4SSH.
SSHUserName optional rw string ntske ≤ 32 characters The user name of the SSH user authentication.
SSHHostKeyPins optional rw string "" comma separated, ≤ 16 SHA-256 fingerprints of the host keys the server may show, in the notation SHA256:<base64> of ssh-keygen -l.
SSHHostCAs optional rw string "" comma separated, ≤ 4 SHA-256 fingerprints of the SSH CA keys that may sign the host certificate of the server.
SSHConnection optional rw OptionList Dedicated Dedicated, Shared Dedicated: an SSH connection of the key exchange's own. Shared: the subsystem is one more channel of the SSH connection the station keeps to the SSH peer ServerURL names (section 8.3). SSHPort, SSHUserName, SSHHostKeyPins and SSHHostCAs then do not apply. Option A is offered before option B where the SSH stack of the station hands out the exporter of its connection.
SSHClientPublicKey optional ro string "" - The public key the charging station authenticates with, in the authorized_keys format of OpenSSH.
SSHHostKeyFingerprint optional ro string "" - The SHA-256 fingerprint of the host key the server showed at its last NTS-KE handshake.

Implemented in the nodes of Open Charging Cloud, with Norn as the client: the time servers of a WWCP_Node make their key exchange over SSH where their entry says so, and the Device Model bridge of WWCP_OCPP maps Mode NTSv4SSH and the variables above onto it. The station makes its key pair at the first read of SSHClientPublicKey and keeps it. A host key is believed by SSHHostKeyPins, or by a host certificate for the server's name of one of the SSHHostCAs; OnPinMismatch applies to both, and nothing is learned on first use (TrustOnFirstUse stays None). The key exchange offers option A before option B, and the cookies are renewed by the next key exchange over SSH, never over TLS. A test sets Mode, SSHPort and SSHHostKeyPins in one SetVariables request and the station's next check of the time makes its key exchange over SSH against an NTS server of Norn, SSHHostKeyFingerprint and Cookies then readable.

With SSHConnection Shared the key exchange is one more channel of the SSH connection the charging station keeps to the SSH peer ServerURL names. The connection belongs to the node (SSHPeer of WWCP_Node, on SshSharedConnection of Hermod): it is made when the first of its users asks for it, the key exchange or OCPP, and each of them closes its own channel, never the connection. The hosts of the station's ssh:// network connection profiles are its SSH peers, and so are the peers of SSHPeerController (OCPP over SSH, section 7.3), which need no OCPP: a node that speaks OCPP over a WebSocket has its time over a peer of its configuration. SSHClientPublicKey then reads the key the station signs in with at that peer, and no key pair of its own is made. Switched to it, a server loses SSHPort, SSHUserName, SSHHostKeyPins, SSHHostCAs and OnPinMismatch, which are rejected while it is set; in a request it is applied after Mode and before the other variables. A test has a CSMS serve the subsystem beside OCPP on one SSH listener: the station's key exchange makes no second login, its cookies work for NTP, and the connection and OCPP go on after it. Another has the key exchange be the first to need the connection, and make it. With a host that is no SSH peer there is no key exchange, and no other way is tried; nor over a connection whose host is held to no pinned key yet.

7.1 OCPP v1.6+SE Configuration Keys

The configuration keys of section 3.3 of the Secure Time Synchronization white paper get the same. ntp.<group>.mode becomes a list per server that takes NTSv4SSH, and the following keys are added, shown for the legal group; the local group and further groups have them under their own id:

Key Name req/opt Accessibility Type Default Value Example Description
ntp.legal.mode required rw CSL String "NTSv4" "NTSv4, NTSv4SSH" Per server: NTSv4 or NTSv4SSH. One value is every server's, as before, and a charging station reads one value where every server has the same mode. See NTPClientController.Mode.
ntske.legal.sshPorts optional rw CSL String "22" "22, 2222" Per server. See SSHPort.
ntske.legal.sshUserNames optional rw CSL String "ntske" "ntske, time" Per server. See SSHUserName.
ntske.legal.sshConnection optional rw CSL String "Dedicated" "Shared, Dedicated" Per server, Dedicated or Shared. See SSHConnection.
ntske.legal.sshHostKeyPins.n optional rw CSL String "" "SHA256:…" The host key pins of the n-th server, numbered as ntske.legal.certificatePins.n. See SSHHostKeyPins.
ntske.legal.sshHostCAs.n optional rw CSL String "" "SHA256:…" The SSH CAs of the n-th server. See SSHHostCAs.
ntske.sshClientPublicKey optional ro String "" "ssh-ed25519 AAAA… cs001" Common to every group: the key the charging station signs in with. See SSHClientPublicKey. A server on the connection of OCPP signs in with the station's OCPP key instead, which the CSMS knows by its login.
ntp.legal.mode                = "NTSv4SSH"
ntske.legal.sshPorts          = "22"
ntske.legal.sshHostKeyPins.1  = "SHA256:…"
ntske.legal.sshHostKeyPins.2  = "SHA256:…"

Implemented in the Device Model bridge of WWCP_OCPP, as the other keys of section 3.3: a key is turned into the SetVariables entries of the variables it stands for, and set with their checks. A test reads ntske.sshClientPublicKey, has it entered at an NTS server of Norn, is refused an SSH port before the mode, sets ntp.local.mode, ntske.local.sshPorts and ntske.local.sshHostKeyPins.1 one at a time, and the station's next check of the time makes its key exchange over SSH.

8. Deployment Profiles

The primary profile is an NTS-KE server with an SSH listener of its own, which serves time clients and administrators alike. A charging infrastructure node that already runs an SSH listener, e.g. for OCPP over SSH, offers the subsystem next to its other ones. An unmodified OpenSSH server with a small helper program remains possible as an alternative.

8.1 NTS-KE Server with an SSH Listener of Its Own

The existing NTS-KE server gets a second listener next to TLS on port 4460. It is a special-purpose SSH server, not a general-purpose one, and offers exactly two things:

Everything else a general-purpose SSH server offers is refused: no operating system shell, no exec requests, no SFTP, no port, agent or X11 forwarding.

Reference implementation: the NTS server of Vanaheimr Norn, which serves NTS-KE over TLS and NTP, and the SSH stack of Vanaheimr Hermod, which implements client and server once for both roles, including hybrid post-quantum key exchange, OpenSSH certificates and SSHFP. Its interoperability with independent SSH implementations is tested by the SSH Conformance Tests. The work proceeds in this order, and all six steps are done:

  1. (done) Norn derives C2S and S2C through the single function Exporter(label, context, L) of section 4.4, with the three sources TLS, SSH exporter and transported secret.
  2. (done) Norn parses and writes the SSH Key Binding record of section 5.
  3. (done) The NTS server of Norn gets the SSH listener of this section with the subsystem ntske/1@open.charging.cloud, with option B only at first.
  4. (done) Hermod adds the SSH exporter of section 4.3 to its key exchange, which enables option A.
  5. (done) The command line of section 8.2 joins the same listener, with separate accounts for time clients and administrators. NTSServerCLI runs the NTS server of Norn as a node of Open Charging Cloud, whose SSH server carries both the subsystem and the command line.
  6. (done) The nodes of Open Charging Cloud offer the subsystem on their shared listener (section 8.3). WWCP_Node adds subsystems to that listener at run time and tells their handlers the authenticated identity of the client and, through Hermod, the exporter of the connection: all that both options need.

What is implemented so far:

8.2 Administration over the Same Listener

An administrator who opens a secure shell to the NTS-KE server gets the server's own command line instead of an operating system shell, in the same way as other command line programs of Open Charging Cloud already offer theirs over SSH. Typical commands:

Access rules:

8.3 Subsystem on the Shared SSH Listener of a Charging Infrastructure Node

A local controller or a CSMS often runs an SSH listener anyway: for its command line, for SFTP, and for OCPP itself when charging stations connect to ssh:// instead of wss://. Each station then pins the host key of the node, and the node knows the public key of each station. This removes certificates from the station network for OCPP in the same way as this paper does for time. Open Charging Cloud carries OCPP and its own node protocol WWCP over SSH as the subsystems ocpp@open.charging.cloud and wwcp@open.charging.cloud. Such a node offers NTS-KE as one more subsystem of the same listener:

SSH listener of a local controller (one port, one host key)
 ├─ shell                        administrators: the command line of the node
 ├─ sftp                         administrators
 ├─ ocpp@open.charging.cloud     charging stations
 ├─ wwcp@open.charging.cloud     neighbouring nodes
 └─ ntske/1@open.charging.cloud  charging stations and other time clients

A subsystem handler for NTS-KE needs two things from the SSH stack of the node: the authenticated identity of the client, and the SSH exporter of the connection for option A. It keeps no state per connection, as the nonce keeps the exchanges apart.

8.4 OpenSSH Subsystem (Alternative)

Operators who prefer to keep an unmodified OpenSSH server can run NTS-KE as an external subsystem. The SSH server takes care of the transport, the host key and the client authentication. A small helper program reads records from stdin, writes records to stdout, and relays both over a local socket to the NTS-KE server. The NTS-KE server generates nts_ke_secret and the cookies there; the master key never leaves it. Only option B is possible.

# /etc/ssh/sshd_config (sketch)
Subsystem ntske/1@open.charging.cloud /usr/lib/ntske/ntske-ssh-helper

Match User ntske
    AuthenticationMethods       publickey
    ForceCommand                /usr/lib/ntske/ntske-ssh-helper
    PermitTTY                   no
    AllowTcpForwarding          no
    AllowStreamLocalForwarding  no
    X11Forwarding               no
    AllowAgentForwarding        no
    PermitUserRC                no

8.5 Clients

A client needs an SSH library with support for subsystems and host key pinning, and for option A access to K and H. A client on the same SSH stack as the server of section 8.1 has both. Clients with off-the-shelf SSH libraries use option B. A charging station that already runs OCPP over SSH (section 8.3) has subsystems and pinning in place, and needs only the NTS-KE records and option B, and for option A the exporter of its SSH stack. For tests, ssh -s is sufficient to request the subsystem and to pass binary records through.

9. Security Considerations

The SSH profile is as secure as the verification of the host key and the negotiated SSH algorithms.

10. Alternatives without SSH

The problem of a missing internal PKI can partly be solved within TLS as well, and interoperably. The SSH transport must be measured against this.

Approach Without CA Without correct clock Client authentication usual Interoperable today Remarks
NTS-KE over SSH (this paper) yes yes yes no uses existing SSH tooling
TLS with a pinned self-signed certificate yes only with an exception no yes CertificatePins, TrustOnFirstUse, NoCertTimeCheckAfterReboot of Secure Time Synchronization; chrony: ntstrustedcerts, nocerttimecheck
TLS 1.3 with raw public keys (RFC 7250) yes yes possible hardly hardly supported by NTS implementations
TLS with DANE-EE (RFC 6698) yes no, RRSIG validity no hardly requires DNSSEC
TLS 1.3 with an external pre-shared key yes yes implicit no symmetric keys, scales poorly

11. Relation to Other White Papers

References

Appendix A: Test Vectors

The test vectors cover option B (section 4.4), the record of section 5 and option A (section 4.3). They were computed independently of the reference implementation, with the hmac and hashlib modules of Python, and the tests of Norn check against them.

A.1 Key Derivation of Option B

nts_ke_secret = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
label         = "EXPORTER-network-time-security"
context       = 0x0000 || AEAD id (16 bits) || 0x00 for C2S, 0x01 for S2C

The info of HKDF-Expand for AEAD_AES_SIV_CMAC_256 and C2S, i.e. string(label) || string(context):

0000001e                                                        length of the label, 30
4558504f525445522d6e6574776f726b2d74696d652d7365637572697479    "EXPORTER-network-time-security"
00000005                                                        length of the context, 5
0000000f00                                                      0x0000, AEAD id 15, C2S

The keys, with L the key length of the algorithm:

AEAD_AES_SIV_CMAC_256 (15), L = 32
  C2S  8a9424e3fd81e14cbc9731adff3ae5b6d2fe66349b4ad384f59a1f5bd7d552ec
  S2C  2abf8475eda5bb1798b5d3d0f2fc413d62461c0bce93707fed97366193422713

AEAD_AES_128_GCM_SIV (30), L = 16
  C2S  e7961cb8c44fcc3d44d091c8574ad0f2
  S2C  964988be02f188bbc3c96bd86bba825d

AEAD_AES_256_GCM_SIV (31), L = 32
  C2S  5f32ede85ca7a7607baa1c2bf14057c9afb7458114e476f6a187f2f96da0aa2e
  S2C  0b6576d8ee6e31e992f4821dac89ec44d1e575a0f1b69a4f64225dc6051ec128

For AEAD_AES_128_GCM_SIV the context carries the id 30, as section 4.3 requires over SSH. An implementation that reuses its TLS code, where the context falls back to the id 15 unless record type 1024 was exchanged, derives other keys over SSH; the second vector catches this.

A.2 The SSH Key Binding Record

The request of the example of section 5, offering the exporter and the transport:

c002 0008 0001 0000 0002 0000
│    │    │    │    │    └─ no data
│    │    │    │    └─ method 0x0002
│    │    │    └─ no data
│    │    └─ method 0x0001
│    └─ length of the body, 8
└─ critical bit and record type 16386

A server skips an entry of a method it does not know by its length, here one of the private range with two bytes of data before the transport:

c002 000a 8001 0002 abcd 0002 0000

The response selecting the transport, with the nts_ke_secret of A.1:

c002 0022 0002 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
│    │    │    └─ nts_ke_secret, 32 bytes
│    │    └─ method 0x0002
│    └─ length of the body, 34
└─ critical bit and record type 16386

The response selecting the exporter, with the exporter_nonce of A.3:

c002 0022 0001 1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
│    │    │    └─ exporter_nonce, 32 bytes
│    │    └─ method 0x0001
│    └─ length of the body, 34
└─ critical bit and record type 16386

A.3 Key Derivation of Option A

The inputs are those of the first key exchange of a connection, so session_id equals H. K is encoded as the key exchange method encodes it for its own key derivation (section 4.3). The first vector takes the shared secret of RFC 7748, section 6.1 as K of curve25519-sha256. The second takes the output of RFC 7748, section 5.2, whose first octet 0xc3 gives the mpint a leading zero octet. H counts upwards, as the exporter treats it as opaque octets.

exporter_secret = HASH(K || H || string("ssh-exporter@open.charging.cloud") || session_id)

string("ssh-exporter@open.charging.cloud")
  00000020 7373682d6578706f72746572406f70656e2e6368617267696e672e636c6f7564

Every vector uses the same nonce. HKDF-Extract and HKDF-Expand take their HMAC from HASH, and the label, the contexts and thus the info of HKDF-Expand are those of A.1.

exporter_nonce = 1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
PRK            = HKDF-Extract(salt = exporter_nonce, IKM = exporter_secret)
curve25519-sha256, HASH = SHA-256, K as an mpint
  K                000000204a5d9d5ba4ce2de1728e3bf480350f25e07e21c947d19e3376f09b3c1e161742
  H = session_id   202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
  exporter_secret  ab559ef9a78c59a68f7be3063df264e2a7ccbe83a49f76ed2aed1327cf89776e
  PRK              a2d98772f94b8fb96dd30707c7c9ad0d278d0ff90a411ad709ce7069b1e4781f
  AEAD 15, L = 32
    C2S  ea9163026944be623b625a50b8f59aa1daf843949e0f98634f178af6e248330a
    S2C  d9376278448d5de12b0d3ebc3c06bf26c0ccc0c85ac869b6a23d10213b7fc402
  AEAD 30, L = 16
    C2S  339eabe19ea8469bbf993ac405a89417
    S2C  26823c8acd419d57fd901749dc6d5d76

curve25519-sha256, HASH = SHA-256, K as an mpint with a leading zero octet
  K                0000002100c3da55379de9c6908e94ea4df28d084f32eccf03491c71f754b4075577a28552
  H = session_id   a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf
  exporter_secret  8cd543f0ab53001f308b027ad13bd42ff218559a5d26d025a410a806ef7b9c77
  PRK              24e54cd9033daa7bb1e5047b90a6a0f53f24e62ad9b9e743a3dfb17a159e4ffb
  AEAD 15, L = 32
    C2S  6d38e2ff8aaaab4842eb4cb3d66712d93d8675efc0cea721f3828f8de3fce947
    S2C  3a177a3612e473add6c214cbdf858b59e7012e0e68676f57692998fb5192a208

mlkem768x25519-sha256, HASH = SHA-256, K as a string
  K                00000020404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f
  H = session_id   606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f
  exporter_secret  2d7dce6143d5be80605b07662a01e4735b32202106be64c66f8392dc51d887f6
  PRK              d4a0a37898cd1bf17500c5c0a6c9285d66087742df355873f912dd058fc94027
  AEAD 15, L = 32
    C2S  10f3f639e505ca255ac1a51d235bac0d0ba15b078774e0c13f7f97a15b93df05
    S2C  8a1e71fceb65e99f0d171f6472e8c9bd7f92f20ad8a5085d3bf9b1d7fec9c28f

sntrup761x25519-sha512, HASH = SHA-512, K as a string
  K                00000040
                   808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f
                   a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf
  H = session_id   c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf
                   e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
  exporter_secret  2d3d49427d4a01a90e66867b65064c5ae726c4ceb833aa06cf03a8a54e1f667c
                   36289f14bfd84e15d4a6793e1bbc7532f3ab4bdc68bab34b0aa471a5068ff4dd
  PRK              ac0a32957f57e5f41866387c4d8313183a6d93b8995d2c84acfe5070af261894
                   80d5dd64e36838e2ac5af9ea77c5c5d8a6d8c207f556880fe5e6e251dbc31615
  AEAD 15, L = 32
    C2S  d8df38f63a6c606738f00b416ee530c2c5b8d54881a72a73e983eac1968bf5b5
    S2C  b611446e12a524681f9fd023eee1a57468a624a3f73b0dd7c6a6d45dd2297414
  AEAD 30, L = 16
    C2S  891071d4dcddf3ec6a2074d58ebe5059
    S2C  423acfe0d50b1c0e571835f70cb4fef0

From exporter_secret on, for an implementation that is handed the secret: with the 32 bytes of the nts_ke_secret of A.1 as exporter_secret, the nonce 202122…3f and SHA-256, the nonce is what makes the keys differ from those of option B:

exporter_secret  000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
exporter_nonce   202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
PRK              a27b86e7a70a029cba778d6f738d952696d6d8361b95103dd84ae9df6af063af
AEAD 15, L = 32
  C2S  dcf81015c16cb4b955624949e824e89f45cac437995a873e938ec3c7adc0218b
  S2C  6b91d1a3ad1eb448fa5010e20dd79b280f7c303aec2252b464a4642fb70ea12d
AEAD 30, L = 16
  C2S  fd8733d215d9d3a79f0d95b86884ed28
  S2C  f7fe123370cdd2ed478906c34bd6d7b8
AEAD 31, L = 32
  C2S  05d23579f0905080af0243173053808adad6d276ed0560a9fe64ef714b690554
  S2C  d72234762b25d744d00016818b8f23ad65d1ac5c85009d1ada6215046c73ebcc

The tests of Hermod check the exporter against these vectors, and the tests of Norn check the keys it derives through the exporter.

ToDo's