Fix CurveServerCertificate setting wrong socket option#1164
Draft
drewnoakes with Copilot wants to merge 2 commits into
Draft
Fix CurveServerCertificate setting wrong socket option#1164drewnoakes with Copilot wants to merge 2 commits into
drewnoakes with Copilot wants to merge 2 commits into
Conversation
…icKey) Previously CurveServerCertificate set CurveServerKey (the remote server's public key used by clients), which meant that a server socket using CurveServerCertificate left its CurveSecretKey as all-zeros. This caused CurveServerMechanism to fail decrypting client HELLO messages, rejecting all clients with a correct certificate. Now CurveServerCertificate sets CurveSecretKey and CurvePublicKey from the provided certificate, matching its name and the natural server-side configuration intent. Clients can use CurveServerKey = serverCert.PublicKey to specify the server's public key for authentication. Adds a regression test (CurveServerCertificateTest) that reproduces the reported issue scenario. Fixes #1163
Copilot
AI
changed the title
[WIP] Fix Curve encryption not accepting client with valid certificate
Fix CurveServerCertificate setting wrong socket option
Jun 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CurveServerCertificatewas settingCurveServerKey(the remote server's public key, a client-side option) instead of the server socket's ownCurveSecretKey+CurvePublicKey. This leftCurveSecretKeyas all-zeros on the server, causingCurveServerMechanismto fail decrypting every client HELLO and silently reject all connections.Changes
SocketOptions.cs/ThreadSafeSocketOptions.cs:CurveServerCertificatenow setsCurveSecretKey+CurvePublicKey(the server's own key pair) instead ofCurveServerKey. Requires a certificate with a secret key. Updated docs to clarify server-side intent and point clients toCurveServerKey = serverCert.PublicKey.CurveTests.cs: AddedCurveServerCertificateTestreproducing the reported pattern.Before / After