Skip to content
This repository was archived by the owner on Jun 25, 2026. It is now read-only.
This repository was archived by the owner on Jun 25, 2026. It is now read-only.

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

Description

@hadibu

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)

上述代码无法解密。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions