提高加密安全性

This commit is contained in:
F嘉阳
2018-02-05 21:15:21 +08:00
parent a31a2ea026
commit 3d81836e0e
3 changed files with 3 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ public class LoginController {
@PostMapping("/login/dologin")
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());
if (user!=null){
request.getSession().setAttribute(USER_SESSION_KEY,user);

View File

@@ -36,7 +36,7 @@ public class RegisterController {
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)){
return "redirect:" + request.getScheme() + "://" + request.getServerName() + ":"
+ serverProperties.getPortNum() + request.getContextPath() + "/index";

View File

@@ -98,7 +98,7 @@ public class CodingUtil {
System.out.println(new String(decryptBASE64(encryptBASE64(data.getBytes()))));
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());
}
}