sesame-esam (Python)
A native Python implementation of SESAME (Secure ESAM Authentication and
Message Encryption), the proposed SCTE 130-9 security layer for the ESAM
interface. A sibling of the Rust crate and C++ SDK in this repo, proven against
the same golden vectors (../test-vectors/), so a Python signer and a Rust,
C++, or rust-pois verifier interoperate byte-for-byte.
- Three tiers over a Tier-0 baseline: HMAC-SHA256 auth (1), channel-scoped authorization (2), AES-256-GCM payload encryption (3), plus signed responses.
- One dependency:
cryptographyfor AES-256-GCM (hmac/hashlibfrom the stdlib cover the rest). - Pythonic API:
verify_request/sign_response; failures raiseSesameError(with.codeand.http_status, Appendix A.7).
PyPI package: sesame-esam; import name: sesame. See
../SESAME.md for the byte-exact wire format (draft v0.5).
The threat model, protocol design, and performance results are published in B. Kelleher, "SESAME: A Layered Security Framework for SCTE 130 ESAM with Sub-Millisecond Overhead", SET International Journal of Broadcast Engineering, vol. 12, 2026, doi:10.18580/setijbe.2026.6. BibTeX is in the main README.
Install
pip install sesame-esam
Quick start
Verify an inbound request (the POIS side):
from sesame import (verify_request, RequestContext, SesameConfig, SesameHeaders,
StaticKeyProvider, ChannelScope, InMemoryReplayCache, Tier, SesameError)
import time
keys = StaticKeyProvider().with_signing_key(
"sas-east-01", b"shared-secret", ChannelScope.list(["SportsFeed-East"]))
replay = InMemoryReplayCache(300)
headers = SesameHeaders.from_lookup(lambda name: request_headers.get(name))
ctx = RequestContext("POST", "/esam", target_channel=None)
try:
v = verify_request(SesameConfig(), keys, replay, ctx, headers, body,
int(time.time()), Tier.ONE)
# v.plaintext is the ESAM XML; v.achieved_tier / v.key_id / v.scope_channel
except SesameError as e:
# e.code (SesameErrorCode), e.http_status
...
Sign an outbound response (the POIS side):
from sesame import sign_response, ResponseParams, SesameConfig, Tier
import time
params = ResponseParams(signing_key_id="pois-primary",
correlation="ap-1:sigid-20260224-001", tier=Tier.ONE)
resp = sign_response(SesameConfig(), keys, params, xml, int(time.time()))
# attach resp.headers (list of (name, value)), send resp.body with resp.content_type
Development
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest -q # conformance (golden vectors) + unit (KATs + negative matrix)
python examples/sign_request.py 3
License
Dual-licensed under MIT or Apache-2.0.
Metadata
Release files for sesame-esam 0.1.4.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sesame_esam-0.1.4.post1.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sesame_esam-0.1.4.post1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.0 kB
Release files / sesame_esam-0.1.4.post1.tar.gz
| Download URL | sesame_esam-0.1.4.post1.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5405e53527d522b7f99dfb9b8cbf1cc96b0d13b879e12b82894c5d063d204884
|
|
BLAKE2b-256 checksum How to use checksums |
c4cfc05dd62aa861fa4ca953b2d191813cb03213bc1fa69d5853c142b050c960
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / sesame_esam-0.1.4.post1-py3-none-any.whl
| Download URL | sesame_esam-0.1.4.post1-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10ab137e826d6ade4f5ceab821cef9c0461afb1e68ca69844b47b91d34348277
|
|
BLAKE2b-256 checksum How to use checksums |
d7952380f0f0a09d7698d543c8906be9a50de2c130ece081dbe1ba978d62de2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|