23 lines
463 B
JavaScript
23 lines
463 B
JavaScript
let sm2CipherUtil = new SM2CipherUtil();
|
|
/**
|
|
* 加密
|
|
*/
|
|
function sm2Encrypt(public_key,text){
|
|
console.log(public_key,text);
|
|
return sm2CipherUtil.sm2Encrypt(public_key, text);
|
|
|
|
}
|
|
/**
|
|
* 私钥解密
|
|
*/
|
|
function sm2Decrypt(private_key,text){
|
|
return sm2CipherUtil.sm2Encrypt(private_key, text);
|
|
}
|
|
/**
|
|
* 生成 公钥和你要
|
|
* @returns {{privateKey: *, publicKey: *}}
|
|
*/
|
|
function doGenerate() {
|
|
return sm2CipherUtil.sm2GengenerateKeys();
|
|
}
|