Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Apr 23, 2024
1 parent 0561ec7 commit 3c79883
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# sm2js
# sm2js (jsrsasign-sm)
[![SM2JS CI](https://github.com/emmansun/sm2js/actions/workflows/ci.yml/badge.svg)](https://github.com/emmansun/sm2js/actions/workflows/ci.yml)
[![npm version](https://badge.fury.io/js/gmsm-sm2js.svg)](https://badge.fury.io/js/gmsm-sm2js)
[![NPM Downloads][npm-downloads-image]][npm-url]

**sm2js is a pure Javascript implementation of the GM-Standards SM2 (also support sm3/sm4) based on [jsrsasign](https://github.com/kjur/jsrsasign).**

您也可以参考另外一个实现:[sjcl-sm](https://github.com/emmansun/sm4js)

## SM2

- sign/verify functions (Passed integration test with ALI KMS)
Expand All @@ -20,7 +22,7 @@ For usage, please reference [sm2_test.js](https://github.com/emmansun/sm2js/blob
**SM3**使用比较简单,请参考[cryptojs_sm3_test.js](https://github.com/emmansun/sm2js/blob/master/src/cryptojs_sm3_test.js "cryptojs_sm3_test.js")。单独的**SM3**实现,可以参考[gmsm-sm3js](https://github.com/emmansun/sm3js)

## SM4
[jsrsasign](https://github.com/kjur/jsrsasign) 内嵌了[crypto-js](https://github.com/brix/crypto-js)的剪裁版本,只支持默认的**CBC**模式和**PKCS7填充**模式(本实现为了测试,添加了ECB模式和无填充填充模式)。本**SM4**实现同时实现了[sjcl](https://github.com/bitwiseshiftleft/sjcl)所需方法,所以可以和sjcl支持的加密模式一起使用。具体使用方法,请参考[cryptojs_sm4_test.js](https://github.com/emmansun/sm2js/blob/master/src/cryptojs_sm4_test.js "cryptojs_sm4_test.js")。当然,把本**SM4**实现和独立的[crypto-js](https://github.com/brix/crypto-js)结合使用也是可以的。单独的**SM4**实现,可以参考[gmsm-sm4js](https://github.com/emmansun/sm4js)
[jsrsasign](https://github.com/kjur/jsrsasign) 内嵌了[crypto-js](https://github.com/brix/crypto-js)的剪裁版本,只支持默认的**CBC**模式和**PKCS7填充**模式(本实现为了测试,添加了ECB模式和无填充填充模式)。本**SM4**实现同时实现了[sjcl](https://github.com/bitwiseshiftleft/sjcl)所需方法,所以可以和sjcl支持的加密模式一起使用。具体使用方法,请参考[cryptojs_sm4_test.js](https://github.com/emmansun/sm2js/blob/master/src/cryptojs_sm4_test.js "cryptojs_sm4_test.js")。当然,把本**SM4**实现和独立的[crypto-js](https://github.com/brix/crypto-js)结合使用也是可以的。

在NodeJS环境下,修改过的```KJUR.crypto.Cipher.encrypt``````KJUR.crypto.Cipher.decrypt```会优先使用NodeJS Native实现,这两个方法目前只支持以下模式:
- aes128-CBC
Expand Down

0 comments on commit 3c79883

Please sign in to comment.