sm2 加密解密通过

This commit is contained in:
cheney
2026-04-18 10:54:59 +08:00
parent 9f6df6bbd8
commit 0cb442eaa0
10 changed files with 1829 additions and 34 deletions
+23
View File
@@ -0,0 +1,23 @@
declare module 'sm-crypto' {
export interface SM2KeyPair {
privateKey: string;
publicKey: string;
}
export const sm2: {
generateKeyPairHex: (privateKey?: string) => SM2KeyPair;
doEncrypt: (message: string, publicKey: string) => string;
doDecrypt: (ciphertext: string, privateKey: string) => string;
doSign: (message: string, privateKey: string) => string;
doVerify: (message: string, signature: string, publicKey: string) => boolean;
};
export const sm3: {
digest: (message: string) => string;
};
export const sm4: {
encrypt: (message: string, key: string, options?: any) => string;
decrypt: (ciphertext: string, key: string, options?: any) => string;
};
}