加密重要信息,如用户名、密码。防止http拦截。浏览器使用公钥加密,服务器端使用私钥解密

页面添加引用:   jsencrypt.min.js

// 3-Url参数加密类
if (window.JSEncrypt) {
    function InitJSEncrypt() {
        var _this = this;
        var encrypt;

        _this.init = function () {
            encrypt = new window.JSEncrypt();
            encrypt.setPublicKey('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');//替换公钥
        };

        _this.getEncrypt = function () {
            if (encrypt == null) {
                _this.init();
            }
            return encrypt;
        };
    };
    $.extend(window.JSEncrypt, new InitJSEncrypt().getEncrypt());
}
//加密用户名密码
var
encryptedEmail = window.JSEncrypt.encrypt(email); var encryptedPass = window.JSEncrypt.encrypt(password);

相关文章:

  • 2022-01-25
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-28
  • 2022-12-23
  • 2022-12-23
  • 2021-06-23
  • 2021-12-28
  • 2022-12-23
相关资源
相似解决方案