Skip to main content

CPIX

Project description

cpix

Python library for working with CPIX 2.1 (DASH-IF Content Protection Information Exchange) documents

For more details on CPIX see:

Supported features

  • Creation of CPIX documents
  • Content keys
  • Usage rules
  • DRM systems
  • Parsing of CPIX documents
  • Validation against CPIX XSD

Not yet implemented

  • Validation of document correctness (e.g. kid referenced by usage rule matches a content key)

Not supported

  • Encryption, decryption and signing are not supported.

Examples

Scripts

Example scripts which can be used with Widevine and Playready test servers to get or create keys and produce CPIX documents are available in example.

Simple CPIX

To create a simple CPIX document with a single key:

import cpix

full_cpix = cpix.CPIX(
    content_keys=cpix.ContentKeyList(
        cpix.ContentKey(
            kid="0DC3EC4F-7683-548B-81E7-3C64E582E136",
            cek="WADwG2qCqkq5TVml+U5PXw=="
        )
    ),
    drm_systems=cpix.DRMSystemList(
        cpix.DRMSystem(
            kid="0DC3EC4F-7683-548B-81E7-3C64E582E136",
            system_id="EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED",
            pssh=("AAAAxnBzc2gBAAAA7e+LqXnWSs6jyCfc1R0h7QAAAAINw+xPdoNUi4HnPGT"
                  "lguE2FEe37S9mVyu9EwbOfPNhDQAAAIISEBRHt+0vZlcrvRMGznzzYQ0SEF"
                  "rGoR6qL17Vv2aMQByBNMoSEG7hNRbI51h7rp9+zT6Zom4SEPnsEqYaJl1Hj"
                  "4MzTjp40scSEA3D7E92g1SLgec8ZOWC4TYaDXdpZGV2aW5lX3Rlc3QiEXVu"
                  "aWZpZWQtc3RyZWFtaW5nSOPclZsG")
        )
    )
)

This can then be printed as a formatted XML document:

print(str(full_cpix.pretty_print(xml_declaration=True), "utf-8'"))
<?xml version='1.0' encoding='utf-8'?>
<CPIX xmlns:pskc="urn:ietf:params:xml:ns:keyprov:pskc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:dashif:org:cpix" xsi:schemaLocation="urn:dashif:org:cpix cpix.xsd">
  <ContentKeyList>
    <ContentKey kid="0dc3ec4f-7683-548b-81e7-3c64e582e136">
      <Data>
        <pskc:Secret>
          <pskc:PlainValue>WADwG2qCqkq5TVml+U5PXw==</pskc:PlainValue>
        </pskc:Secret>
      </Data>
    </ContentKey>
  </ContentKeyList>
  <DRMSystemList>
    <DRMSystem kid="0dc3ec4f-7683-548b-81e7-3c64e582e136" systemId="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
      <PSSH>AAAAxnBzc2gBAAAA7e+LqXnWSs6jyCfc1R0h7QAAAAINw+xPdoNUi4HnPGTlguE2FEe37S9mVyu9EwbOfPNhDQAAAIISEBRHt+0vZlcrvRMGznzzYQ0SEFrGoR6qL17Vv2aMQByBNMoSEG7hNRbI51h7rp9+zT6Zom4SEPnsEqYaJl1Hj4MzTjp40scSEA3D7E92g1SLgec8ZOWC4TYaDXdpZGV2aW5lX3Rlc3QiEXVuaWZpZWQtc3RyZWFtaW5nSOPclZsG</PSSH>
    </DRMSystem>
  </DRMSystemList>
</CPIX>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cpix-1.0.2.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

cpix-1.0.2-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file cpix-1.0.2.tar.gz.

File metadata

  • Download URL: cpix-1.0.2.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.1

File hashes

Hashes for cpix-1.0.2.tar.gz
Algorithm Hash digest
SHA256 50125f5fd5d2fe0b171d6239f5c4051c02ad0515330d3ce4115f7bbba38374d4
MD5 b0b9d91831ddf081a6a964de202aa8d4
BLAKE2b-256 6c22b3d3eff92a79ff12dbf58070d32878d7ef275ea750ba4b66a116c213947f

See more details on using hashes here.

File details

Details for the file cpix-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: cpix-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.1

File hashes

Hashes for cpix-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8d0080a467ce8cc0b0046dcba41393aa112bae0c6ec926e9b3488ce8ece1188c
MD5 628f659054695ff473d5cf3f401f1d81
BLAKE2b-256 e5e31c799eb42e0b15331d1eb3c8bed52af9b9ce3a50805162a2ff462138d2ae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page