sm2 加密解密通过
This commit is contained in:
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
declare module 'gmsm-sm2js' {
|
||||
export function generateKeyPairHex(privateKey?: string): { privateKey: string; publicKey: string };
|
||||
export function encrypt(publicKey: string, message: string): string;
|
||||
export function decrypt(privateKey: string, ciphertext: string): string;
|
||||
export function sign(privateKey: string, message: string): string;
|
||||
export function verify(publicKey: string, message: string, signature: string): boolean;
|
||||
}
|
||||
Vendored
+23
@@ -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;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user