刘河 6 years ago
parent
commit
24bd9ce6ba
2 changed files with 6 additions and 1 deletions
  1. 4 0
      README.md
  2. 2 1
      web/controllers/auth.go

+ 4 - 0
README.md

@@ -1774,6 +1774,10 @@ POST /auth/getauthkey
 将返回加密后的authKey,采用aes cbc加密,请使用与服务端配置文件中cryptKey相同的密钥进行解密
 
 **注意:** nps配置文件中`auth_crypt_key`需为16位
+- 解密密钥长度128
+- 偏移量与密钥相同
+- 补码方式pkcs5padding
+- 解密串编码方式 十六进制
 
 ### 详细文档
 - 此文档近期可能更新较慢,建议自行抓包

+ 2 - 1
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
 	}