Open creatxrgithub opened 5 years ago
let rsa = forge.pki.rsa; let keypair = rsa.generateKeyPair({bits: 2048, e: 0x10001}); let encrypted = keypair.publicKey.encrypt(forge.util.createBuffer('你我他','utf8'), 'RSAES-PKCS1-V1_5'); console.log(typeof encrypted); console.log('--------------'); let decrypted = keypair.privateKey.decrypt(encrypted, 'RSAES-PKCS1-V1_5');
output:
string -------------- /app/node_modules/node-forge/lib/rsa.js:1563 throw new Error('Encryption block is invalid.'); ^ Error: Encryption block is invalid. ------
what's the problem ? thanks. what's the pr
let encrypted = keypair.publicKey.encrypt(forge.util.createBuffer('你我他','utf8').getBytes(), 'RSAES-PKCS1-V1_5');
output:
what's the problem ? thanks. what's the pr