diff --git a/README.md b/README.md index 04b3a2b..943ce55 100644 --- a/README.md +++ b/README.md @@ -1774,6 +1774,10 @@ POST /auth/getauthkey 将返回加密后的authKey,采用aes cbc加密,请使用与服务端配置文件中cryptKey相同的密钥进行解密 **注意:** nps配置文件中`auth_crypt_key`需为16位 +- 解密密钥长度128 +- 偏移量与密钥相同 +- 补码方式pkcs5padding +- 解密串编码方式 十六进制 ### 详细文档 - 此文档近期可能更新较慢,建议自行抓包 diff --git a/web/controllers/auth.go b/web/controllers/auth.go index d0305f3..5c0f15a 100644 --- a/web/controllers/auth.go +++ b/web/controllers/auth.go @@ -1,6 +1,7 @@ package controllers import ( + "encoding/hex" "github.com/cnlh/nps/lib/crypt" "github.com/cnlh/nps/vender/github.com/astaxie/beego" ) @@ -25,7 +26,7 @@ func (s *AuthController) GetAuthKey() { return } m["status"] = 1 - m["crypt_auth_key"] = string(b) + m["crypt_auth_key"] = hex.EncodeToString(b) m["crypt_type"] = "aes cbc" return }