npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gmsm-sm2js

v0.7.0

Published

Pure Javascript implementation of the SM2/SM3/SM4 functions based on jsrsasign

Downloads

618

Readme

sm2js (jsrsasign-sm)

SM2JS CI npm version NPM Downloads

sm2js is a pure Javascript implementation of the GM-Standards SM2 (also support sm3/sm4) based on jsrsasign.

您也可以参考另外一个实现:sjcl-sm

SM2

  • sign/verify functions (Passed integration test with ALI KMS)
  • sm2Sign/sm2Verify functions (include uid and curve related parameters in signature)
  • encrypt/decrypt functions (Passed integration test with ALI KMS), support both PLAIN and ASN.1 encoding format ciphertext output
  • SM2 certificate signing request generation and parse
  • SM2 certificate parse and verify signature, test CA & certificate are generated from https://www.gmcert.org/
  • Parse SM2 private key in PKCS8 format (both encrypted and plaintext).

For usage, please reference sm2_test.js

SM3

SM3使用比较简单,请参考cryptojs_sm3_test.js。单独的SM3实现,可以参考gmsm-sm3js

SM4

jsrsasign 内嵌了crypto-js的剪裁版本,只支持默认的CBC模式和PKCS7填充模式(本实现为了测试,添加了ECB模式和无填充填充模式)。本SM4实现同时实现了sjcl所需方法,所以可以和sjcl支持的加密模式一起使用。具体使用方法,请参考cryptojs_sm4_test.js。当然,把本SM4实现和独立的crypto-js结合使用也是可以的。

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

  • aes128-CBC
  • aes256-CBC
  • des-EDE3-CBC
  • sm4-CBC