代码拉取完成,页面将自动刷新
同步操作将从 vnool/robot-tools 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const NodeRSA = require('node-rsa');
var key = new NodeRSA({
b: 512
});
// key.generateKeyPair();
// console.log(key.exportKey('pkcs8-public'));
// console.log(key.exportKey('pkcs8-private'));
var publicKey =
`-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqwEDC2qq+Dg4nwGA+svd
Nr/Dg4Op1vXeD5H00/4J2KxBplfhc9cexGoisRVcH/GyhjPQtynn79ybWfCo5DxR
SiSIoqeB4//JG5c8zsuTaqaKbcyfQjlRelYABRGyqm8cRApg4ZVx6Or7+1AsIMLK
DzykHGCPxww/P00S9NhuKOEak8KXvjtNPUCq+5OMPHBVlYJgMrrfRlRTf87COdA3
Th743Ov2z5kh+V1wPiWU6htXXLA1biXWY0mveXFZIxrz3T2ji6LuZMg0rv9bOhSF
yQFqrP1THLAG2khcLK78muMMFkFMMHBv1Odms1XXpgOn9eMClMRqMCgwfGQ6mlL5
CwIDAQAB
-----END PUBLIC KEY-----`;
var privateKey =
`-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCrAQMLaqr4ODif
AYD6y902v8ODg6nW9d4PkfTT/gnYrEGmV+Fz1x7EaiKxFVwf8bKGM9C3Kefv3JtZ
8KjkPFFKJIiip4Hj/8kblzzOy5NqpoptzJ9COVF6VgAFEbKqbxxECmDhlXHo6vv7
UCwgwsoPPKQcYI/HDD8/TRL02G4o4RqTwpe+O009QKr7k4w8cFWVgmAyut9GVFN/
zsI50DdOHvjc6/bPmSH5XXA+JZTqG1dcsDVuJdZjSa95cVkjGvPdPaOLou5kyDSu
/1s6FIXJAWqs/VMcsAbaSFwsrvya4wwWQUwwcG/U52azVdemA6f14wKUxGowKDB8
ZDqaUvkL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KBgQCEGQ7TSyz1FaOPQhId
fQm200ToubheG4T4WHxBUWttirSmDepvW+jWHq/qlDzTSoA27c2gHZhJFHay42C7
scN3MeZD1XthDqgglldaYYxH3Qou3jxnhcL4uF3xgGFF24Wvs+/JetcnKoLklvpG
A5WABWxdq7rRDYwwC2gYxrQttQ==
-----END PRIVATE KEY-----`;
key = new NodeRSA();
key.importKey(publicKey);
//key.importKey(privateKey);
// const text = 'Hello RSA!';
// const encrypted = key.encrypt(text, 'base64');
// console.log('encrypted: ', encrypted);
// const decrypted = key.decrypt(encrypted, 'utf8');
// console.log('decrypted: ', decrypted);
module.exports = {
privateKey,
publicKey,
encode: function(text) {
return key.encrypt(text, 'base64');
},
decode: function(encrypted) {
return key.decrypt(encrypted, 'utf8');
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。