js国密sm2与sm4算法混合加密
sm2与sm4的加密原理可以查看根目录的doc文件夹,关于sm2与sm4的混合加密算法如下:
Data encryption process:
加密过程明文通过sm4(ecb)模式进行加密,再通过sm2(c1c2c3)加密sm4的密钥。
Instructions:
You need install package "encrytion-tools" to project.
npm i encrytion-tools --save
or yarn add encrytion-tools --save
// the example for crypt and encrypt by SM2, but SM4 and mix‘s like it. // 1.import functional like "sm2"、"sm4" in "mixSm2andSM4" by npm package //-------sm2---------// 2.the step paly construct crpt or encrypt classconst _sm2 = // encryptconst result = _sm2// cryptconst result = _sm2 // -------sm4...// -------mix...
- SM2 encrypt
- SM4 encrypt
- SM2 and SM4 mix encrypt
- SM2 decrypt
- SM2 decrypt
- SM2 and SM4 mix decrypt