Pure Elixir SM2 cryptographic operations (GM/T 0003-2012).
SM2 is a Chinese commercial cryptographic algorithm standard for:
- Key pair generation (ECDH)
- Digital signature (ECDSA with SM3 pre-hash)
- Encryption/decryption (ECDH + SM3 KDF + XOR + SM3 MAC)
This is a pure Elixir implementation with no external dependencies.
Summary
Types
Functions
@spec decrypt(binary(), binary()) :: {:ok, binary()} | {:error, error_reason()}
@spec encrypt(binary() | iodata(), binary()) :: {:ok, binary()} | {:error, error_reason()}
@spec sign(binary() | iodata(), binary()) :: {:ok, binary()} | {:error, error_reason()}
@spec supported?() :: boolean()