A free, open-source reimplementation of Google's Widevine Content Decryption
Module (CDM) — the piece of a browser that obtains content keys for protected
media and decrypts that media. It is a drop-in replacement for Google's
proprietary widevinecdm.dll / libwidevinecdm.so / libwidevinecdm.dylib
and implements the same shared-library CDM API used by Chromium and
Firefox.
This project is a from-scratch port, written in nimony (a Nim-family language), of the architecture pioneered by Thomas Hebb's Rust project openwv. The protocol, algorithms, and ABI match openwv; the implementation is independent.
Not affiliated with or endorsed by Google or Widevine. For interoperability and research. You are responsible for complying with the terms of any service you use it with.
Like openwv, this CDM ships with no device identity and does nothing
without one. A device identity (a .wvd file) holds a Widevine
client's metadata and the RSA private key that authenticates it to license
servers. You must obtain an appropriate .wvd yourself. Because browsers
sandbox the CDM and forbid it from reading files at runtime, the identity —
like all configuration — is baked in at build time: there are no official
binaries, the only supported way to use this is to build it yourself.
Place your file at the repository root as embedded.wvd before building. It is
.gitignored and must never be committed.
The CDM ABI is C++ (a vtable subclass of cdm::ContentDecryptionModule_10/_11)
and the crypto is heavy, so the port is layered:
browser ─(C++ vtable)─▶ cpp/shim.cpp ─(flat C ABI)─▶ nimony logic ─(flat C ABI)─▶ cpp/wvcrypto.c ─▶ mbedTLS
CreateCdmInstance, wv_* exports src/*.nim wvc_* imports libmbedcrypto.a
Host_NN callbacks (state, protocol, protobuf, parsing,
session machine) KDF, decrypt flow
cpp/shim.cpp— the only C++. Implements the exported entry points (InitializeCdmModule_4,CreateCdmInstance, …), subclasses the CDM interface, and exposes the host callbacks (Host_10/11) as plain C functions the nimony layer calls. See docs/DESIGN.md.src/*.nim— all logic: config,.wvdparsing, PSSH/CENC init-data parsing, the Widevine protobuf codec, the session state machine, license request/response, session-key derivation, and the decrypt dispatch. Compiled to C by nimony, then linked in.cpp/wvcrypto.c— a thin flat-C wrapper over mbedTLS giving the nimony layer exactly the primitives it needs (AES-CTR/CBC, AES-CMAC, HMAC-SHA256, SHA-1/256, RSA-PSS-SHA1 sign/verify, RSA-OAEP-SHA1 enc/dec, PKCS#1 DER import, CSPRNG).
References gathered during the port live in docs/: the CDM ABI, the
Widevine protocol algorithms, and the protobuf schema.
See docs/BUILD.md. In short:
- Install the nimony toolchain, a C/C++ compiler (MinGW-w64 gcc/g++ on Windows), and CMake.
tools/fetch-mbedtlsto vendor and buildlibmbedcrypto.a.- Put your
embedded.wvdat the repo root. tools/build→ produceswidevinecdm.dll(or.so/.dylib).
Installation into Firefox / Chrome / Kodi follows openwv's instructions exactly; see docs/INSTALL.md.
LGPL-3.0-only, matching openwv (whose structure this port follows). See
LICENSE.