Skip to main content

CPIX

Project description

cpix

Python library for working with CPIX 2.2 (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.

Installation

Install using pip:

pip install cpix

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.1.4.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

cpix-1.1.4-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cpix-1.1.4.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.10

File hashes

Hashes for cpix-1.1.4.tar.gz
Algorithm Hash digest
SHA256 7780c99c03aa16686fd54c1f342cb36d5da1b433fac19b8bb75029b4ad4f91a4
MD5 8544ae29ea4a15522e407b6ca475b75a
BLAKE2b-256 e72bd373a22528cd0b6cc73991850328992ac17654daeab701984673820bd051

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cpix-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 26.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.10

File hashes

Hashes for cpix-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3e6f5fcfa7d82fd7c861251a470551b462bf42f0672384165b3e5845b7380b1a
MD5 84496d9c95910f0d116c6ffe07f22954
BLAKE2b-256 a69a5c2e9aace4ac519de4ec3c4132a2880ff17ac5207c9b9e7c730d98f2091a

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