Skip to main content

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: cryptography for AES-256-GCM (hmac/hashlib from the stdlib cover the rest).
  • Pythonic API: verify_request / sign_response; failures raise SesameError (with .code and .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.post2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sesame-esam 0.1.4.post2
File Size Uploaded
sesame_esam-0.1.4.post2.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sesame-esam 0.1.4.post2
File Interpreter ABI Platform
sesame_esam-0.1.4.post2-py3-none-any.whl Python 3 none any Details

Total release size: 23.0 kB

Release files / sesame_esam-0.1.4.post2.tar.gz

Download URL sesame_esam-0.1.4.post2.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dd9f85b686d364f21f9da4cc26b13472c7eadadfe83c5a02421e4706427fa077
BLAKE2b-256 checksum
How to use checksums
c0f9e73bd1e4c99a11b50623aef75c3e04df0d80cacfd38835ff516f4313170c
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.post2-py3-none-any.whl

Download URL sesame_esam-0.1.4.post2-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13f50f557eff297430451c5ff6a755663f65a80fd303a79582d220e8a7f94347
BLAKE2b-256 checksum
How to use checksums
d17e28a221e2a2c9bf409d04d252171088fbc9b23e9d352dab266f7f11cd5a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.4.post2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page