aardio怎么实现rsa公钥解密?
网站上能正常解密,aardio上用公钥无法解密
import console;
import crypt.rsa;
rsa = crypt.rsa()
rsa.importPemKey("-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDC00HJHgujOJ8eBXgkweewbPHr
LwVly4hDdthy19562d4wbqONyHwXeAN9xoL33MHJxPRUaMI/B3/3ZhI9Mhk4/Z17
0GlpPWY7Y62T4E+tbuXETGL1jV5GAtaqYhZMU6v1Q8Q6pF7KJP+qsxnh+9KnI9y2
usfgDjKpdCgj4OXxiQIDAQAB
-----END PUBLIC KEY-----")
var str = "GINXxgTJ3JGubVwACKBLOzeW2968zqModmakKYx3/yVuOLJlbVQVSXm8b8A4+QiZMNG4BzO77rx0O5LBDIy6tE+cFhmn99R4cPz+yTGZsgE+95+dAOUPEGdSy9KHV2U1v490SV4CsQbGmi/+UI/MDAh8N/bzcfOcJc/nf79PJBc="
var ciphertext = crypt.decodeBin(str);
if(!ciphertext){
winform.msgboxErr("解密失败,请检查是否输入了 Base64 编码的密文");
return;
}
//console.log("base64解密数据",ciphertext);
//与其他编程语言互通必须使用 rsa.decryptReverse() 而非 rsa.decrypt() 函数
var plaintext = rsa.decrypt(ciphertext);
console.log("解密数据",plaintext);
console.pause(true);
页:
[1]