Uh oh!
There was an error while loading. Please reload this page.
Use BCL Curve25519 for Windows 10+ - #1702
Conversation
f5486b5 to
9d15116CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
actually, it is not working on my win10 22H2 machine (connected aborted). develop branch works fine, using curve25519-sha256 |
Co-authored-by: Rob Hague <rob.hague00@gmail.com>
scott-xu
commented
Sep 27, 2025
Based on your description, it does not throw exception when get the named curve. May related to agreement derivation. |
Rob-Hague
commented
Sep 27, 2025
Right, see wireshark.zip. I see the bad capture (on this branch) is sending ECDH init with a key length of 65 bytes (containing 32 trailing zeroes), and the server closes the connection. The good capture (on develop) is sending with 32 byte key, and everything works fine |
Rob-Hague
commented
Sep 27, 2025
this works diff --git a/src/Renci.SshNet/Security/KeyExchangeEC.BclImpl.cs b/src/Renci.SshNet/Security/KeyExchangeEC.BclImpl.cs
index 54757719..571614f6 100644
--- a/src/Renci.SshNet/Security/KeyExchangeEC.BclImpl.cs+++ b/src/Renci.SshNet/Security/KeyExchangeEC.BclImpl.cs@@ -23,17 +23,15 @@ public override byte[] GenerateClientECPoint()
var q = _clientECDH.PublicKey.ExportParameters().Q;
- return EncodeECPoint(q);+ return q.X;
}
public override byte[] CalculateAgreement(byte[] serverECPoint)
{
- var q = DecodeECPoint(serverECPoint);-
var parameters = new ECParameters
{
Curve = _curve,
- Q = q,+ Q = new ECPoint { X = serverECPoint, Y = new byte[serverECPoint.Length] },
};
using var serverECDH = ECDiffieHellman.Create(parameters); |
scott-xu
commented
Sep 27, 2025
That's really strange. Not sure why integration test passes. |
338e205 to
295b2b5Compare
Beginning in Windows 10, CNG provides support for Curve25519.
See https://learn.microsoft.com/en-us/windows/win32/seccng/cng-named-elliptic-curves