cryptsm2-sm4
v1.0.1
Published
crypt sm2、sm4 and sm2 mix sm4 content (gm)
Downloads
1
Readme
js国密sm2与sm4算法混合加密
sm2与sm4的加密原理可以查看根目录的doc文件夹,关于sm2与sm4的混合加密算法如下:
Data encryption process:
加密过程明文通过sm4(ecb)模式进行加密,再通过sm2(c1c2c3)加密sm4的密钥。
Instructions:
You need install package "mixSM2andSM4" to project.
npm i mixSM2andSM4 --save
or yarn add mixSM2andSM4 --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
import {sm2,sm4,mixCrypt} from 'mixSm2andSM4'
//-------sm2---------
// 2.the step paly construct crpt or encrypt class
const _sm2 = new sm2()
// encrypt
const result = _sm2.crypt(publicKey,value)
// crypt
const result = _sm2.encrypt(publickey,privateKey,value)
// -------sm4
...
// -------mix
...
- [x] SM2 encrypt
- [x] SM4 encrypt
- [x] SM2 and SM4 mix encrypt
- [ ] SM2 crypt
- [ ] SM2 crypt
- [ ] SM2 and SM4 mix crypt