lizhichao/one-sm
lizhichao/one-sm is a lightweight PHP library implementing China's SM2, SM3, and SM4 cryptographic algorithms. It offers SM2 key generation, signing, verification, encryption and decryption, SM3 hashing, and SM4 symmetric encryption through a simple API for secure PHP applications.
ext-openssl (1.1.1+ ships SM2/SM3/SM4), (c) adopt a library like this. This package makes (c) viable for teams on older PHP builds, shared hosting, or environments where the OpenSSL SM provider isn't compiled in. It reframes the build/buy question from "can we do crypto?" to "how do we isolate crypto behind an interface?"04 uncompressed-point prefix. A pure-PHP implementation with these knobs saves you the discovery cycle that otherwise burns a sprint in partner UAT. Budget the decision as "one integration spike per partner," not "one crypto ticket."CryptoProvider interface is roughly 1–2 sprints including test vectors and partner interop; replacing it later with OpenSSL or a commercial SDK/HSM is then a swap, not a rewrite. That optionality is the main strategic argument for adoption.Consider it when:
ext-openssl on your target runtime lacks SM support.Look elsewhere when:
To executives: This is a small, free, open-source PHP library that gives us the Chinese national cryptographic algorithms (SM2/SM3/SM4) that PRC partners and regulators increasingly require. It removes the "we can't technically support China" blocker in about one to two sprints of integration work, versus a much larger build or a commercial licensing conversation. It is not a complete compliance solution — key management, audit, and certification remain separate, scoped decisions. Recommended ask: a time-boxed spike plus a security review, not a commitment.
To engineering: Treat it as a reference implementation we wrap, not a black box we depend on. Put it behind our own CryptoProvider interface, pin and vendor the version, add known-answer test vectors, and instrument real partner payloads early — interop encoding is where the time goes, not the algorithm. Assume we may swap to ext-openssl SM support or an HSM-backed service later, and design so that swap is a config change. Do not use it for high-volume or high-value key material without a review of constant-time properties and key storage.
How can I help you explore Laravel packages today?