春风项目四线(合箱线、总装线)
jiang
2024-01-22 9a90543b32701590952806ed583347460bc04f76
提交 | 用户 | 时间
fd2207 1 import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
2
3 // 密钥对生成 http://web.chacuo.net/netrsakeypair
4
5 const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' +
6   'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
7
8 const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' +
9   '7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' +
10   'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' +
11   'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' +
12   'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' +
13   'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' +
14   'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' +
15   'UP8iWi1Qw0Y='
16
17 // 加密
18 export function encrypt(txt) {
19   const encryptor = new JSEncrypt()
20   encryptor.setPublicKey(publicKey) // 设置公钥
21   return encryptor.encrypt(txt) // 对数据进行加密
22 }
23
24 // 解密
25 export function decrypt(txt) {
26   const encryptor = new JSEncrypt()
27   encryptor.setPrivateKey(privateKey) // 设置私钥
28   return encryptor.decrypt(txt) // 对数据进行解密
29 }
30