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

Uploaded Source

Built Distribution

cpix-1.3.0-py3-none-any.whl (29.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cpix-1.3.0.tar.gz
  • Upload date:
  • Size: 23.6 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.3.0.tar.gz
Algorithm Hash digest
SHA256 24c3f1d7a5190252b69dfd49be210f09e911a266db3b50d5d4e1c9417c869af3
MD5 e23610a740fa9601784ad983d4724124
BLAKE2b-256 f477f6cce4f7dcb4aab051d72f23f50066af584f4a34a5cb59b52a2dbf66226c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cpix-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 29.5 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3045bfa398376594f235c5551994a4b2a9794dcacf81ee95e2915ad180e8cf76
MD5 897383eaa75d6c415e8b8d23321b8daa
BLAKE2b-256 747cc38cb6fd7509d359d6ba1da265b8727c1f7eda71cfc16cd6218e027ab8df

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