npm install --save jsencrypt

import {JSEncrypt} from 'jsencrypt';

//导入公钥
if ( publicKey.indexOf('-----') < 0 ) {
publicKey = "-----BEGIN PUBLIC KEY-----" + publicKey + "-----END PUBLIC KEY-----";
}
var encrypt = new JSEncrypt();
encrypt.setPublicKey(publicKey);

if( password instanceof Array ){
password = password.join('|');
}

data = encrypt.encrypt(password)
或者
data = encodeURIComponent( encrypt.encrypt(password) )


引入cryptico.js
    shaKey和pubKey为后台返回
    res = res || {
"shaKey": "",
"pubKey": ""
};

cryptico.setPublicKeyString(res);


加密密码
cryptico.encrypt(pwd);

相关文章:

  • 2022-12-23
  • 2022-03-01
  • 2021-11-13
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-03-02
  • 2022-12-23
  • 2022-02-23
  • 2021-10-04
相关资源
相似解决方案