sm-crypto icon indicating copy to clipboard operation
sm-crypto copied to clipboard

sm2加密无法处理全零的情况

Open hadibu opened this issue 6 years ago • 0 comments

let keypair = sm2.generateKeyPairHex(); let publicKey = keypair.publicKey; // 公钥 let privateKey = keypair.privateKey; // 私钥 const cipherMode = 0; // 1 - C1C3C2,0 - C1C2C3,默认为1 let buf = Buffer.alloc(1); let encryptData = sm2.doEncrypt(buf.toString(), publicKey, cipherMode); // 加密结果 let dec = sm2.doDecrypt(encryptData, privateKey)

上述代码无法解密。

hadibu avatar Feb 21 '19 01:02 hadibu