提高加密安全性
This commit is contained in:
@@ -30,7 +30,7 @@ public class LoginController {
|
|||||||
@PostMapping("/login/dologin")
|
@PostMapping("/login/dologin")
|
||||||
public String doLogin(TbUser tbUser)throws Exception{
|
public String doLogin(TbUser tbUser)throws Exception{
|
||||||
//加密用户密码
|
//加密用户密码
|
||||||
tbUser.setColpassword(new BigInteger(CodingUtil.encryptSHA(tbUser.getColpassword().getBytes())).toString());
|
tbUser.setColpassword(new BigInteger(CodingUtil.encryptSHA(tbUser.getColpassword().getBytes())).toString(32));
|
||||||
TbUser user = userService.doLoginService(tbUser.getColname(),tbUser.getColpassword());
|
TbUser user = userService.doLoginService(tbUser.getColname(),tbUser.getColpassword());
|
||||||
if (user!=null){
|
if (user!=null){
|
||||||
request.getSession().setAttribute(USER_SESSION_KEY,user);
|
request.getSession().setAttribute(USER_SESSION_KEY,user);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class RegisterController {
|
|||||||
throw new UserException(resultEnum);
|
throw new UserException(resultEnum);
|
||||||
}
|
}
|
||||||
//加密用户密码
|
//加密用户密码
|
||||||
tbUser.setColpassword(new BigInteger(CodingUtil.encryptSHA(tbUser.getColpassword().getBytes())).toString());
|
tbUser.setColpassword(new BigInteger(CodingUtil.encryptSHA(tbUser.getColpassword().getBytes())).toString(32));
|
||||||
if (userService.doRegisterService(tbUser)){
|
if (userService.doRegisterService(tbUser)){
|
||||||
return "redirect:" + request.getScheme() + "://" + request.getServerName() + ":"
|
return "redirect:" + request.getScheme() + "://" + request.getServerName() + ":"
|
||||||
+ serverProperties.getPortNum() + request.getContextPath() + "/index";
|
+ serverProperties.getPortNum() + request.getContextPath() + "/index";
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class CodingUtil {
|
|||||||
System.out.println(new String(decryptBASE64(encryptBASE64(data.getBytes()))));
|
System.out.println(new String(decryptBASE64(encryptBASE64(data.getBytes()))));
|
||||||
|
|
||||||
System.out.println(new BigInteger(encryptMD5(data.getBytes())).toString());
|
System.out.println(new BigInteger(encryptMD5(data.getBytes())).toString());
|
||||||
System.out.println(new BigInteger(encryptSHA(data.getBytes())).toString());
|
System.out.println(new BigInteger(encryptSHA(data.getBytes())).toString(32));
|
||||||
System.out.println(new BigInteger(encryptHMAC(data.getBytes(), initMacKey())).toString());
|
System.out.println(new BigInteger(encryptHMAC(data.getBytes(), initMacKey())).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user