Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

One Sm Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

  • Architecture fit: lizhichao/one-sm is a Composer-installable PHP library for the Chinese national cryptographic hash SM3 (国密 SM3), with likely companion SM2/SM4 support that must be verified. It fits Laravel as a low-level crypto adapter behind application services, not as a replacement for Laravel’s Hash, Crypt, or Encrypter facades. SM3 is a digest primitive; it is appropriate for integrity checks, HMAC construction, and as the digest step in SM2 signatures. It is not a password-hashing/KDF algorithm by itself and should not replace bcrypt/Argon2 without a defined PBKDF2/HMAC-SM3 construction.
  • Integration feasibility: Straightforward composer require and direct class usage. Expect to write your own Laravel service provider, config, facade, and contract binding. Cross-check outputs against GM/T 0004-2012 test vectors and, where available, OpenSSL’s SM3 implementation. Binary digest handling requires disciplined hex/base64 encoding at boundaries.
  • Technical risk: Moderate-to-high for a crypto dependency. Risks include correctness of SM2 signing/verification, constant-time behavior, random-number handling, padding/mode misuse for SM4, lack of independent security audit, limited adoption signals (190 stars, 0 dependents), and unclear long-term maintainer commitment. Pure-PHP crypto may also fail regulatory expectations where certified commercial cryptographic modules are required. A 3.65 score and opportunity score of 33 suggest a niche, usable package rather than a strategically strong dependency.
  • Key questions: Which algorithms and modes are actually implemented—SM2, SM3, SM4, SM4-GCM, HMAC-SM3? Are official test vectors covered? Is the implementation constant-time where relevant? What PHP versions and extensions are supported? What is the license and security-disclosure process? Is it pure PHP or native-extension backed? Has it been reviewed or certified for 国密 compliance? How does it interoperate with HSMs, gateways, and OpenSSL/BouncyCastle? What is the performance profile for bulk hashing and signing?

Integration Approach

  • Stack fit: Suitable for Laravel 9/10/11 on PHP 8.x as a domain-layer crypto adapter. Keep it isolated from framework internals: define Sm3Hasher, Sm2Signer, or GuomiCrypto contracts, bind implementations in a service provider, and expose config for algorithm selection, encoding, and key references. Use feature flags per tenant/region so non-China deployments continue using existing OpenSSL/default crypto.
  • Migration path: Inventory all current hashing, signing, and encryption usage first. Introduce the package side-by-side rather than swapping primitives in place. For stored digests, add an algorithm identifier column and support dual verification during transition; rehash non-password data opportunistically or via queue jobs. For signatures, version payload formats and verify old and new signatures during rollout. Do not rehash passwords directly with SM3; if 国密 password hashing is mandated, define PBKDF2-HMAC-SM3 parameters and migrate on successful login.
  • Compatibility: Verify PHP version constraints, ext-openssl, ext-mbstring, and Composer conflicts before adoption. Confirm binary output handling with database collations, JSON APIs, queue serialization, and Laravel encryption/session cookies. Ensure the package does not interfere with Laravel’s default OpenSSL-based encryption. Test under Octane and long-running workers for memory/state issues.
  • Sequencing: 1) Spike with official SM3 test vectors and benchmark. 2) Build a thin adapter with unit/property tests. 3) Apply to non-critical checksums or audit-log integrity. 4) Add HMAC-SM3 where message authentication is needed. 5) Trial SM2 signatures in staging with interoperability tests. 6) Production rollout behind feature flags. 7) Complete security and compliance review before regulated use.

Operational Impact

  • Maintenance: Pin the package version and treat it as vendored crypto. Monitor upstream commits, issues, and security advisories; be prepared to fork or wrap with an internal maintained implementation. Add dependency review to CI and document the crypto design and test vectors.
  • Support: Expect community-only support with no SLA. Assign an internal owner, create runbooks, and define an incident process for digest/signature failures. Do not rely on the package maintainer for production escalation.
  • Scaling: Pure-PHP SM3 will be slower than native OpenSSL SM3. Benchmark hashing and signing throughput; avoid SM3 in hot request paths for large payloads. Prefer native OpenSSL SM3 where available and keep the package as fallback. Use queues for bulk rehashing and monitor CPU/latency under Octane.
  • Failure modes: Incorrect digests, signature verification failures, encoding mismatches, SM2 nonce/randomness issues, SM4 padding/mode errors, key-management mistakes, and interoperability failures with HSMs or counterparties. Add observability for digest mismatch rates, signature failure rates, crypto latency, and fallback usage. Plan for algorithm/version rollback.
  • Ramp-up: The team will need 国密-specific training: SM3 vs. password hashing, SM2 signature encoding, SM4 modes, test vectors, and compliance boundaries. Budget for security review and interoperability testing with external 国密 gateways before production.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin