欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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