← Back to case studies

Case Study Β· Architecture & Security Β· 2020–2021

Beating the Pirates: A Custom Content-Protection Protocol for a Closed Video Platform

Secure Video LMS Β· Axoten Innovations Β· Role: Solutions Architect & founding engineer

Built on standard cryptography β€” not homemade. A word before the story, because “custom protocol” rightly makes good engineers nervous: I did not reinvent cryptography. The scheme stands on proven, industry-standard primitives β€” Elliptic-Curve Diffie–Hellman (ECDH) key exchange, multi-layered encryption, and strong authentication β€” and it follows established security best practices throughout. Rolling your own cipher is a cardinal sin; I didn’t commit it. What’s custom is the delivery and packaging layer that sits on top of that standard foundation. The cryptography is deliberately boring and battle-tested. The engineering is in how content is streamed and gated β€” not in the math.

Implementation details are deliberately omitted to protect IP and avoid aiding reverse engineering. Architecture-level tradeoffs available under NDA.

A note on this write-up: the decisions, reasoning, and engineering here are entirely mine β€” the polished prose is not. I fed my own notes and solution to an AI to turn them into something readable, because I’d rather ship the story than spend hours wordsmithing it. I’m a software engineer, not a writer, and I’d sooner be upfront about that than pretend otherwise.

The decision in one line

The heart of this project wasn’t code β€” it was a threat-model decision: for a closed, whitelisted audience, fighting piracy with standard, widely-tooled formats is a losing game, so I kept the standard cryptography and made the transport proprietary β€” changing the shape of the lock while keeping the proven metal. Here’s how I got there.

The setup

Late 2020. Covid, curfew, classrooms shut. Sri Lanka’s massive private-tuition industry β€” the machine that preps students for the A/L exams β€” had nowhere to go. An institute came to us with an order: build them a Learning Management System, fast.

We shipped the first release in weeks: courses, lessons, attendance, payments, and video streaming. For video we made the pragmatic call β€” embed a third-party host. It offloaded our bandwidth, saved months of work, and got students learning again.

Within days, full lessons were circulating in Telegram groups. That kicked off an eight-month arms race that ended with me designing a custom streaming protocol β€” and it’s the work I’m proudest of.

flowchart LR
  A["Third-party embed"] -->|links scraped| B["Native apps"]
  B -->|"sniffing + TLS MITM"| C["Custom protocol<br/>(standard crypto inside)"]
  C -->|holds| D["~95% blocked"]
  style C fill:#4a9eff,stroke:#4a9eff,color:#fff
  style D fill:#1f7a3d,stroke:#1f7a3d,color:#fff

The arms race (why every standard fix failed)

Each defense fell for the same reason, and spotting that pattern was the whole insight.

Every round, the attackers won with off-the-shelf tools β€” and the HTTPS-interception step proved something important: transport security alone was never going to be enough.

The decision β€” and the reasoning behind it

The team was ready to give up. The only “real” answer was industry-standard DRM β€” and the institute rejected it on cost, with sharp logic: “Netflix has DRM and new releases are pirated the day they drop. Why pay a fortune for something that doesn’t even stop the pros?”

They were right. So I stopped trying to make the lock stronger and started asking a different question. The reasoning, step by step:

1 Β· Identify the real limitation. Every tool we’d tried failed because the technology was common. There are entire online communities and ready-made tools dedicated to breaking exactly these standard formats. The problem was never cryptographic strength β€” it was ubiquity. Standard = tooled = beatable by a teenager.

2 Β· Understand the actual audience. This wasn’t Netflix. It was a closed, whitelisted platform β€” only enrolled A/L students could ever touch it. A niche of a niche. That completely reshapes the threat model: the realistic attacker is a casual student with a downloader, and the global piracy community has zero incentive to invest real effort into cracking something only used by Sri Lankan tuition students. There’s no payoff.

3 Β· Make the call. If the audience is closed and the value-to-an-attacker is near-zero, then being “standard” isn’t a virtue β€” it’s a liability, because standard is precisely what the tools target. So: keep the proven cryptography, but wrap it in a proprietary streaming and packaging protocol that no off-the-shelf tool understands. Change the shape of the lock; keep the battle-tested metal inside.

4 Β· Ground it in fundamentals (non-negotiable). Custom packaging, standard security underneath β€” ECDH key exchange, multi-layered encryption, authentication, and security best practices. The proprietary layer is obscurity as one layer of defense, never the foundation. If the custom layer were ever fully understood, the cryptography still has to hold on its own. That discipline is what separates this from “homemade DRM.”

This is also the direct answer to the HTTPS-interception attack: because the content is encrypted independently of the transport, an attacker who fully MITMs the TLS channel β€” their own root certificate, their own proxy β€” still recovers nothing usable. Protection that lives only at the transport layer dies the moment someone installs a trusted root cert; ours doesn’t depend on the channel being private.

5 Β· Define success honestly. The goal was never “unbreakable.” It was “not worth breaking.” Success = the attacker’s effort must exceed the attacker’s payoff. Concretely: no off-the-shelf tool works, casual downloading stops, and the economics hold for years.

Why it worked

Against that bar, it delivered. There was nothing on the internet to copy-paste an attack from, and no incentive for anyone skilled to build one β€” cracking a niche protocol used only by A/L students earns them nothing. The attack economics collapsed. They went after the encryption keys and failed; the standard-crypto foundation held exactly as designed.

The honest limit

No protection is absolute, and I won’t pretend otherwise. The scheme defeats every off-the-shelf tool and casual attack β€” but a determined specialist with deep low-level skills eventually found a theoretical edge (exactly one person did, a university researcher β€” it takes that level of effort). That’s the ceiling of this approach, and I know precisely where it sits.

So rather than chase an unwinnable 100%, we treated the last sliver as a different problem and layered on deterrence-and-detection β€” at a high level: digital watermarking, steganographic tracing, and analytics-driven monitoring. The philosophy shifted from “make it impossible” to “make it pointless, and make offenders traceable.”

Result: ~95% of unauthorized downloads and screen recordings eliminated β€” and the remaining fraction pushed into effort no ordinary user would ever attempt.

Where it landed

This isn’t a demo β€” it’s in production. Several institutes run their learning platforms on the system I architected:

Why I keep this one close

I built this in the pre-ChatGPT era. No AI pair-programmer, no Stack Overflow answer waiting β€” some of the questions I hit had no answers at all. Reading the media-codec internals felt like reading quantum physics. It was just me and the compiler, night after night, until it worked.

A curfew order for a stopgap LMS turned into a custom streaming protocol β€” standard cryptography, proprietary delivery β€” that outlived every attack thrown at it. That’s the work I point to when someone asks what I can do with a hard problem and no map.

Skills: threat modeling & security-first design Β· applied cryptography (ECDH, layered encryption, authentication) Β· custom protocol design on standard primitives Β· solution architecture Β· cross-platform media engineering (iOS / Android / Windows / web / desktop) Β· high-bandwidth video delivery at scale Β· independent R&D on undocumented ground.
Implementation specifics omitted to protect IP and avoid aiding reverse engineering. Happy to walk through the architecture and tradeoffs in an interview under NDA.
← Back to case studies