Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hadibu opened this issue Feb 21, 2019 · 0 comments
Open

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

hadibu opened this issue Feb 21, 2019 · 0 comments

Comments

@hadibu
Copy link

hadibu commented Feb 21, 2019

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)

上述代码无法解密。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant