From acd3cce667ffc07d76f66761a9174583ebe904d2 Mon Sep 17 00:00:00 2001 From: Senis John Date: Tue, 13 Dec 2022 20:43:02 +0800 Subject: [PATCH] fix: trim length of userKey for ss2022 --- service/controller/userbuilder.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/service/controller/userbuilder.go b/service/controller/userbuilder.go index 3c2ee74..5c43a65 100644 --- a/service/controller/userbuilder.go +++ b/service/controller/userbuilder.go @@ -81,11 +81,15 @@ func (c *Controller) buildSSUser(userInfo *[]api.UserInfo, method string) (users // // shadowsocks2022 Key = openssl rand -base64 32 and multi users needn't cipher method if C.Contains(shadowaead_2022.List, strings.ToLower(method)) { e := c.buildUserTag(&user) + userKey := user.Passwd[:32] + if strings.Contains(method, "128") { + userKey = userKey[:16] + } users[i] = &protocol.User{ Level: 0, Email: e, Account: serial.ToTypedMessage(&shadowsocks_2022.User{ - Key: base64.StdEncoding.EncodeToString([]byte(user.Passwd)), + Key: base64.StdEncoding.EncodeToString([]byte(userKey)), Email: e, Level: 0, }),