前端Vue密码加密和后台JAVA解密
前端对密码加密:const user = encryption({data: userInfo,key: 'love',param: ['password']})后端对密码进行解密:private static final String KEY_ALGORITHM = "AES";private Stri...
·
前端对密码加密:
const user = encryption({
data: userInfo,
key: 'love',
param: ['password']
})
后端对密码进行解密:
private static final String KEY_ALGORITHM = "AES";
private String final key = "love";
private static String decryptAES(String data, String key) {
AES aes = new AES(Mode.CBC, Padding.NoPadding,
new SecretKeySpec(pass.getBytes(), KEY_ALGORITHM),
new IvParameterSpec(pass.getBytes()));
byte[] result = aes.decrypt(Base64.decode(data.getBytes(StandardCharsets.UTF_8)));
return new String(result, StandardCharsets.UTF_8);
}
public static void main(String[] args) {
String test= decryptAES("LFEt60GoMTj5/mQQ7HjJeA==", "love");
System.out.println(test);
}
更多推荐
已为社区贡献1条内容
所有评论(0)