阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
484 B

2 years ago
  1. import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
  2. // 密钥对生成 http://web.chacuo.net/netrsakeypair
  3. const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
  4. '2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
  5. // 加密
  6. export function encrypt(txt) {
  7. const encryptor = new JSEncrypt()
  8. encryptor.setPublicKey(publicKey) // 设置公钥
  9. return encryptor.encrypt(txt) // 对需要加密的数据进行加密
  10. }