jsencrypt.js 301 B

12345678910111213
  1. import JSEncrypt from '@/node_modules/jsencrypt/bin/jsencrypt.js'
  2. export function encrypt(txt, publickey) {
  3. if (!publickey) {
  4. return "";
  5. }
  6. const encryptor = new JSEncrypt()
  7. // 设置公钥
  8. encryptor.setPublicKey(publickey)
  9. // 对数据进行加密
  10. return encryptor.encrypt(txt.toString())
  11. }