Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
No Matches
XBMCAddon::xbmcdrm::CryptoSession Class Reference

Kodi's DRM class. More...

#include <DrmCryptoSession.h>

Inheritance diagram for XBMCAddon::xbmcdrm::CryptoSession:

Public Member Functions

 CryptoSession (const String &UUID, const String &cipherAlgorithm, const String &macAlgorithm)
 ~CryptoSession () override
 GetKeyRequest (...)

Function: GetKeyRequest(init, mimeType, offlineKey, optionalParameters)

Generate a key request
 GetPropertyString (...)

Function: GetPropertyString(name)

Request a system specific property value of the DRM system.
 ProvideKeyResponse (...)

Function: ProvideKeyResponse(response)

Provide a key response
 RemoveKeys (...)

Function: RemoveKeys()

Removes all keys currently loaded in a session.
 RestoreKeys (...)

Function: RestoreKeys(keySetId)

Restores session keys stored during previous ProvideKeyResponse call.
 SetPropertyString (...)

Function: SetPropertyString(name, value)

Set a system specific property value in the DRM system.
 Decrypt (...)

Function: Decrypt(cipherKeyId, input, iv)

Decrypt an encrypted data by using session keys.
 Encrypt (...)

Function: Encrypt(cipherKeyId, input, iv)

Encrypt data by using session keys.
 Sign (...)

Function: Sign(macKeyId, message)

Generate a DRM encrypted signature for a text message.
 Verify (...)

Function: Verify(macKeyId, message, signature)

Verify the validity of a DRM signature of a text message.
- Public Member Functions inherited from XBMCAddon::AddonClass
 AddonClass ()
virtual ~AddonClass ()
const char * GetClassname () const
LanguageHookGetLanguageHook ()
bool isDeallocating ()
void Release () const
void Acquire () const

Additional Inherited Members

- Static Public Member Functions inherited from XBMCAddon::AddonClass
static short getNumAddonClasses ()
- Protected Member Functions inherited from XBMCAddon::AddonClass
virtual void deallocating ()
- Static Protected Member Functions inherited from XBMCAddon::AddonClass
static short getNextClassIndex ()
- Protected Attributes inherited from XBMCAddon::AddonClass

Detailed Description

Kodi's DRM class.

Offers classes and functions that allow a developer to work with DRM-protected contents like Widevine.

This type of functionality is closely related to the type of DRM used and the service to be implemented.

Using the CryptoSession constructor allow you to have access to a DRM session. With a DRM session you can read and write the DRM properties GetPropertyString, SetPropertyString and establish session keys with GetKeyRequest and ProvideKeyResponse, or resume previous session keys with RestoreKeys.

When the session keys are established you can use these methods to perform various operations: Encrypt / Decrypt for data encryption / decryption, Sign / Verify for make or verify data-signature. Useful for example to implement encrypted communication between a client and the server.

An example where such functionality is useful is the Message Security Layer (MSL) transmission protocol used in some VOD applications. This protocol (or rather framework) is used to increase the level of security in the exchange of messages (such as licences, manifests or other data), which defines a security extension / layer on top of the HTTP protocol.

Constructor for DRM crypto session

Class: xbmcdrm.CryptoSession(UUID, cipherAlgorithm, macAlgorithm)

UUIDstring - 16 byte UUID of the DRM system to use
cipherAlgorithmstring - Algorithm used for encryption / decryption ciphers
macAlgorithmstring - Algorithm used for sign / verify
RuntimeExceptionIf the session can not be established

v18 Python API changes
New class added.


uuid_widevine = 'edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'
crypto_session = xbmcdrm.CryptoSession(uuid_widevine, 'AES/CBC/NoPadding', 'HmacSHA256')

Constructor & Destructor Documentation

◆ CryptoSession()

XBMCAddon::xbmcdrm::CryptoSession::CryptoSession ( const String & UUID,
const String & cipherAlgorithm,
const String & macAlgorithm )

◆ ~CryptoSession()

XBMCAddon::xbmcdrm::CryptoSession::~CryptoSession ( )

The documentation for this class was generated from the following files: