# `ExCEP.Transport.Cipher`

Pluggable payload encryption behaviour for CSG CEP TS6.3 encrypted communication.

Built-in implementations:
- `ExCEP.Crypto.SM4` — Pure Elixir GB/T 32907 SM4-CBC / SM4-CTR encryption.
- `ExCEP.Transport.NoopCipher` — Plaintext pass-through.

Pass `cipher: {ExCEP.Crypto.SM4, key: key_16b, mode: :cbc}` in connection or server
options to enable transparent SM4 encryption of all APDU ASDU payloads.

# `decrypt`

```elixir
@callback decrypt(ciphertext :: binary(), opts :: keyword()) ::
  {:ok, binary()} | {:error, term()}
```

# `encrypt`

```elixir
@callback encrypt(plaintext :: binary(), opts :: keyword()) ::
  {:ok, binary()} | {:error, term()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
