From 2d5475f42896347af4beea5f529dfe2cf41b2200 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Sat, 26 Aug 2023 07:45:24 +0000 Subject: [PATCH] Update transport/internet/reality/reality.go Fixes https://github.com/XTLS/Xray-core/issues/2491 --- transport/internet/reality/reality.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transport/internet/reality/reality.go b/transport/internet/reality/reality.go index e55f9417..b430cccc 100644 --- a/transport/internet/reality/reality.go +++ b/transport/internet/reality/reality.go @@ -5,6 +5,7 @@ import ( "context" "crypto/aes" "crypto/cipher" + "crypto/ecdh" "crypto/ed25519" "crypto/hmac" "crypto/rand" @@ -134,7 +135,8 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati if config.Show { fmt.Printf("REALITY localAddr: %v\thello.SessionId[:16]: %v\n", localAddr, hello.SessionId[:16]) } - uConn.AuthKey = uConn.HandshakeState.State13.EcdheParams.SharedKey(config.PublicKey) + publicKey, _ := ecdh.X25519().NewPublicKey(config.PublicKey) + uConn.AuthKey, _ = uConn.HandshakeState.State13.EcdheKey.ECDH(publicKey) if uConn.AuthKey == nil { return nil, errors.New("REALITY: SharedKey == nil") }