Skip to content

Advertise the RFC 8731 kex name curve25519-sha256 - #187

Merged
vicajilau merged 1 commit into
TerminalStudio:masterfrom
NEXT176-s-r-o:nviper/curve25519-sha256-alias
Jul 27, 2026
Merged

Advertise the RFC 8731 kex name curve25519-sha256#187
vicajilau merged 1 commit into
TerminalStudio:masterfrom
NEXT176-s-r-o:nviper/curve25519-sha256-alias

Conversation

@nickn17

@nickn17 nickn17 commented Jul 27, 2026

Copy link
Copy Markdown

Problem

curve25519-sha256@libssh.org and curve25519-sha256 are two names for the same key exchange — the latter is the name RFC 8731 standardised. dartssh2 only ever advertises the libssh.org spelling.

OpenSSH matches algorithm names literally, so a server hardened down to a single kex:

KexAlgorithms curve25519-sha256

shares no name with us and the handshake dies with Bad state: No matching key exchange algorithm, even though both sides implement exactly the same X25519 exchange. That configuration is a common hardening recipe, so this is not an exotic server.

Reproduced against OpenSSH 9.9 offering kexAlgorithms: [curve25519-sha256, ext-info-s, kex-strict-s-v00@openssh.com].

Change

  • SSHKexType.x25519Rfc — same digestSha256, RFC name.
  • Offered right after x25519 in the default SSHAlgorithms.kex list.
  • One extra case in the transport switch, falling through to the same SSHKexX25519().

No wire-format change: identical exchange, identical digest, only the negotiated name differs. The default-algorithm-list assertion in test/src/algorithm/ssh_cipher_type_test.dart is updated for the new entry; dart test passes (292 tests).

Verified end to end: with this patch (plus aes*-gcm@openssh.com in the cipher list) an SFTP session against the hardened server above connects and lists directories; unpatched it fails at KEXINIT.

The kex is offered under two names: the original
curve25519-sha256@libssh.org and the RFC 8731 name curve25519-sha256.
Only the former was advertised, so a server hardened down to a single
kex (KexAlgorithms curve25519-sha256, a common hardening recipe) shares
no name with us and the handshake fails with "no matching key exchange
method found" — even though both sides implement the very same X25519
exchange.

Add SSHKexType.x25519Rfc with the RFC name, offer it right after the
libssh.org spelling, and route it to the same SSHKexX25519 in the
transport switch. No wire-format change: same digest, same exchange.
@vicajilau
vicajilau merged commit 4a1a10d into TerminalStudio:master Jul 27, 2026
1 check passed
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 55.92%. Comparing base (0d2900d) to head (e09f8db).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
lib/src/ssh_transport.dart 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #187      +/-   ##
==========================================
- Coverage   55.93%   55.92%   -0.02%     
==========================================
  Files          66       66              
  Lines        5472     5473       +1     
==========================================
  Hits         3061     3061              
- Misses       2411     2412       +1     
Flag Coverage Δ
unittests 55.92% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
lib/src/algorithm/ssh_kex_type.dart 100.00% <ø> (ø)
lib/src/ssh_algorithm.dart 100.00% <ø> (ø)
lib/src/ssh_transport.dart 52.65% <0.00%> (-0.09%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants