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
14 lines
484 B
import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
|
|
|
|
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
|
|
|
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
|
|
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ=='
|
|
|
|
// 加密
|
|
export function encrypt(txt) {
|
|
const encryptor = new JSEncrypt()
|
|
encryptor.setPublicKey(publicKey) // 设置公钥
|
|
return encryptor.encrypt(txt) // 对需要加密的数据进行加密
|
|
}
|
|
|