Wasabi ExpressPlay SDK for Embedded Systems  1.10
Data Structures | Typedefs | Enumerations | Functions
WsbEcmDecrypter.h File Reference

Wasabi EcmDecrypter API. More...

#include "WsbTypes.h"
#include "WsbMediaFile.h"
#include "WsbKeyManager.h"

Go to the source code of this file.

Data Structures

struct  WSB_KsmInfo
 MPEG-2 TS ECM/KSM info. More...
 
struct  WSB_EcmDecrypter_Listener
 ECM decrypter listener callback object type. More...
 

Typedefs

typedef struct WSB_EcmDecrypter WSB_EcmDecrypter
 WsbEcmDecrypter.h Interface to MPEG2 TS traffic key recovery. More...
 

Enumerations

enum  WSB_Mpeg2TsTrafficKey_Parity {
  WSB_MP2TS_KEY_EVEN,
  WSB_MP2TS_KEY_ODD
}
 Two kinds of BBTS traffic keys. More...
 
enum  WSB_Mpeg2TsTrafficKey_ProtectionSystem {
  WSB_NO_TRAFFIC_PROTECTION,
  WSB_UNSUPPORTED_TRAFFIC_PROTECTION,
  WSB_MPEG2TS_CRYPT_AES_CBC_PROTECTION,
  WSB_MPEG2TS_CRYPT_AES_CBC_BBTS20_PROTECTION,
  WSB_MPEG2TS_CRYPT_DVB_CSA_PROTECTION
}
 Traffic keys protection system. More...
 
enum  WSB_Mpeg2TsTrafficKey_Format {
  WSB_MP2TS_KEY_FORMAT_CLEAR,
  WSB_MP2TS_KEY_FORMAT_SKB
}
 MPEG-2 TS traffic key format. More...
 
enum  WSB_KsmInfoFlag {
  WSB_KIF_CURRENT_KEY = (1<<0),
  WSB_KIF_CURRENT_IV = (1<<1),
  WSB_KIF_NEXT_KEY = (1<<2),
  WSB_KIF_NEXT_IV = (1<<3),
  WSB_KIF_ACCESS_CRIT = (1<<4),
  WSB_KIF_TIMESTAMP = (1<<5),
  WSB_KIF_KEY_LIFETIME = (1<<6),
  WSB_KIF_PERMCATEGORY = (1<<7)
}
 KSM info field flags. More...
 

Functions

WSB_EXPORT WSB_Result WSB_EcmDecrypter_Create (const WSB_EcmDecrypter_Listener listener, WSB_Mpeg2TsTrafficKey_Format key_format, const void *key_format_params, WSB_EcmDecrypter **ecm_decrypter)
 Instantiates a new WSB_EcmDecrypter object. More...
 
WSB_EXPORT WSB_Result WSB_EcmDecrypter_Destroy (WSB_EcmDecrypter *ecm_decrypter)
 Destroys a WSB_EcmDecrypter object. More...
 
WSB_EXPORT WSB_Result WSB_EcmDecrypter_UpdatePmt (WSB_EcmDecrypter *ecm_decrypter, const WSB_Byte *pmt_table, WSB_Size pmt_len, WSB_UInt16 *ecm_pid)
 Provides the ECM decrypter object with a new PMT table. More...
 
WSB_EXPORT WSB_Result WSB_EcmDecrypter_UpdateCat (WSB_EcmDecrypter *ecm_decrypter, const WSB_Byte *cat_table, WSB_Size cat_len, WSB_UInt16 *mrt_pid)
 Provides the ECM decrypter object with a new CAT table. More...
 
WSB_EXPORT WSB_Result WSB_EcmDecrypter_UpdateEcm (WSB_EcmDecrypter *ecm_decrypter, const WSB_Byte *ecm_table, WSB_Size ecm_len)
 Provides the ECM decrypter object with a new ECM table (KSMT in IEC 62455 terms). More...
 
WSB_EXPORT WSB_Result WSB_EcmDecrypter_UpdateMrt (WSB_EcmDecrypter *ecm_decrypter, const WSB_Byte *mr_table, WSB_Size mrt_len)
 Provides the ECM decrypter object with a new MRT (Marlin Rights Table) table. More...
 

Detailed Description

Wasabi EcmDecrypter API.

Typedef Documentation

WsbEcmDecrypter.h Interface to MPEG2 TS traffic key recovery.

This is a utility module that can aid an application processing a Marlin Broadband Transport Stream (Marlin BBTS), which is an MPEG-2 Transport Stream containing Marlin-protected content.

A WSB_EcmDecrypter can process and extract useful information from various tables in the stream: PMTs (Program Map Tables), ECMs (Entitlement Control Messages), CATs (Conditional Access Tables), and MRTs (Marlin Rights Tables), supplying the client information needed in order to support playback of the content. One of its most important features is that it can decrypt and return to the client the traffic keys (stored in the ECMs) that are needed in order to decrypt the Transport Stream media content packets.

The following pseudocode illustrates calling WSB_EcmDecrypter methods to process a PMT and an ECM, and shows client code for calling WSB_PlaybackEnabler interfaces to obtain a license and to also obtain the Marlin keys required to decrypt the Marlin content:

WSB_PlaybackEnabler_Create(enabler_listener, &enabler); WSB_PlaybackEnabler_ResolveUrl(enabler, url, &content_url); WSB_EcmDecrypter_Create(ecm_listener, WSB_MP2TS_KEY_FORMAT_CLEAR, NULL, &ecm_dec); // read content from content_url and recover PAT and PMT tables ...

WSB_EcmDecrypter_UpdatePmt(ecm_dec, pmt, pmt_length, &ecm_pid); // add PID filter for ecm_pid...

// for each new ECM table: WSB_EcmDecrypter_UpdateEcm(ecm_dec, ecm, ecm_length);

Listener methods for ecm_listener passed to WSB_EcmDecrypter_Create:

ecm_listener.OnNewMediaFile(media_file, key_manager) { // Try to have a valid license for the content found: WSB_PlaybackEnabler_EnableMediaFile(enabler, media_file, NULL, 0); // If license was found, determine whether playback is allowed: WSB_PlaybackEnabler_PerformPlayAction(enabler, &action_result); // Handle any DRM/license issues here. // Determine whether client can handle all critical obligations // and callbacks. If so, and playback is allowed, call the // following to obtain the content keys and supply them to // the WSB_KeyManager key_manager. WSB_PlaybackEnabler_AcceptActionResult(enabler, key_manager, NULL); }

ecm_listener.OnNewKsmInfo(ksm_info) { // Prepare to use the traffic keys and other info in ksm_info // as needed to decrypt subsequent TS media content packets } A WSB_EcmDecrypter object can be used to have Marlin BBTS MPEG-2 Transport Stream tables processed, and to obtain the traffic keys required to decrypt the TS media content packets.

Enumeration Type Documentation

KSM info field flags.

Enumerator
WSB_KIF_CURRENT_KEY 
WSB_KIF_CURRENT_IV 
WSB_KIF_NEXT_KEY 
WSB_KIF_NEXT_IV 
WSB_KIF_ACCESS_CRIT 
WSB_KIF_TIMESTAMP 
WSB_KIF_KEY_LIFETIME 
WSB_KIF_PERMCATEGORY 

MPEG-2 TS traffic key format.

Enumerator
WSB_MP2TS_KEY_FORMAT_CLEAR 

Clear AES 16-byte key, and 16-byte IV.

WSB_MP2TS_KEY_FORMAT_SKB 

SecureKeyBox-exported traffic key.

Two kinds of BBTS traffic keys.

Enumerator
WSB_MP2TS_KEY_EVEN 
WSB_MP2TS_KEY_ODD 

Traffic keys protection system.

Enumerator
WSB_NO_TRAFFIC_PROTECTION 
WSB_UNSUPPORTED_TRAFFIC_PROTECTION 
WSB_MPEG2TS_CRYPT_AES_CBC_PROTECTION 
WSB_MPEG2TS_CRYPT_AES_CBC_BBTS20_PROTECTION 
WSB_MPEG2TS_CRYPT_DVB_CSA_PROTECTION