utils/pcrypto: fix the bug of using aes

1. The aes IV needs to be unique, but not secure.
2. The key should be 16, 24 or 32 bytes.

Fixes #85.
This commit is contained in:
fatedier
2016-08-21 23:28:01 +08:00
parent 2b1c39e03d
commit c8e5096f48
3 changed files with 66 additions and 17 deletions

View File

@@ -229,6 +229,7 @@ func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
} else if req.PrivilegeKey != privilegeKey {
info = fmt.Sprintf("ProxyName [%s], privilege mode authorization failed", req.ProxyName)
log.Warn(info)
log.Debug("PrivilegeKey [%s] and get [%s]", privilegeKey, req.PrivilegeKey)
return
}
} else {
@@ -241,6 +242,7 @@ func doLogin(req *msg.ControlReq, c *conn.Conn) (ret int64, info string) {
} else if req.AuthKey != authKey {
info = fmt.Sprintf("ProxyName [%s], authorization failed", req.ProxyName)
log.Warn(info)
log.Debug("AuthKey [%s] and get [%s]", authKey, req.AuthKey)
return
}
}