- import JSEncrypt from '@/node_modules/jsencrypt/bin/jsencrypt.js'
- export function encrypt(txt, publickey) {
- if (!publickey) {
- return "";
- }
- const encryptor = new JSEncrypt()
- // 设置公钥
- encryptor.setPublicKey(publickey)
- // 对数据进行加密
- return encryptor.encrypt(txt.toString())
- }
|