AES页面加解密
程序员文章站
2024-03-14 14:21:10
...
<!DOCTYPE html>
<html lang="en" xmlns:th="www.thymeleaf.org">
<head>
<meta charset="UTF-8"/>
<title></title>
<script th:src="@{../js/aes.js}"/>
<script th:src="@{../js/pad-zeropadding.js}"/>
<script th:src="@{../js/security.js}"/>
<script th:src="@{../js/jquery.min.js}"/>
</head>
<body>
<button onclick="saveUser()">保存</button>
<button onclick="findUser()">查找用户</button>
<script>
function saveUser() {
console.log("发送数据:"+Encrypt(JSON.stringify({loginName:"张三"})));
$.ajax({
type:"post",
url:"/save",
data:Encrypt(JSON.stringify({loginName:"张三"})),
dataType:"json",
contentType:"application/json",
success:function(result){
console.log("返回数据:"+result);
console.log("解密之后:"+Decrypt(result));
console.log("解密之后转json对象:"+JSON.parse(Decrypt(result)));
}
});
}
function findUser() {
$.get("/find",function (result) {
console.log("--result:"+Decrypt(result));
});
}
</script>
</body>
</html>
上一篇: 【加密解密】-AES加密解密实现
下一篇: 对称加密之基于口令的加密解密