Wasabi ExpressPlay SDK for Embedded Systems  1.10
Data Structures | Macros | Typedefs | Enumerations | Functions
Ts2Protection.h File Reference
#include "Atomix.h"
#include "Ts2Packet.h"
#include "Ts2Iec62455.h"
#include "Ts2Crypto.h"

Go to the source code of this file.

Data Structures

struct  TS2_DrmKeyResolver
 
struct  TS2_SecretAesCbcDecrypter
 Decrypter structure for the decrypter created by the TS2_CryptoInterface CreateSecretAesCbcDecrypter function. More...
 
struct  TS2_CryptoInterface
 Clients of the MPEG-2 TS SDK API must implement the following interface (TS2_CryptoInterface) to provide some cryptographic functionality that might be needed by the API. More...
 
struct  TS2_TagLengthValue
 
struct  TS2_KsmInfo
 
struct  TS2_KsmDecrypterListener
 

Macros

#define TS2_PROTECTION_KEY_LENGTH   16
 
#define TS2_SecretAesCbcDecrypter_Decrypt(self, a, b, c)   self->Decrypt(self->instance,a,b,c)
 Convenience macros. More...
 
#define TS2_SecretAesCbcDecrypter_Destroy(self)   self->Destroy(self)
 
#define TS2_Crypto_GetDrmKey(self, a, b)   self.GetDrmKey(self.instance,a,b)
 Convenience macros. More...
 
#define TS2_Crypto_TruncatedSha1(self, in_key, out_key)   self.TruncatedSha1(self.instance,in_key,out_key)
 
#define TS2_Crypto_ExportSecret(self, a, b, c)   self.ExportSecret(self.instance,a,b,c)
 
#define TS2_Crypto_GetKeyFormat(self, a, b)   self.GetKeyFormat(self.instance,a,b)
 
#define TS2_Crypto_EqualSecret(self, a, b, c)   self.EqualSecret(self.instance,a,b,c)
 
#define TS2_Crypto_ReleaseSecret(self, a)   self.ReleaseSecret(self.instance,a)
 
#define TS2_Crypto_UnwrapSecret(self, a, b, c, d)   self.UnwrapSecret(self.instance,a,b,c,d)
 
#define TS2_Crypto_GetMacKey(self, a, b, c, d)   self.GetMacKey(self.instance,a,b,c,d)
 
#define TS2_Crypto_CreateSecretAesCbcDecrypter(self, a, b, c, d)   self.CreateSecretAesCbcDecrypter(self.instance,a,b,c,d)
 

Typedefs

typedef struct TS2_PacketEncrypter TS2_PacketEncrypter
 
typedef struct TS2_PacketDecrypter TS2_PacketDecrypter
 
typedef struct TS2_ProtectionKeyMap TS2_ProtectionKeyMap
 
typedef struct TS2_Secret TS2_Secret
 An opaque data structure defined by an implementation of the TS2_CryptoInterface. More...
 
typedef struct TS2_KsmDecrypter TS2_KsmDecrypter
 

Enumerations

enum  TS2_TrafficKeyFormat {
  TS2_KEYFORMAT_CLEAR,
  TS2_KEYFORMAT_SKB
}
 Traffic key format identifiers. More...
 
enum  TS2_TrafficProtectionSystem {
  TS2_NO_TRAFFIC_PROTECTION,
  TS2_UNSUPPORTED_TRAFFIC_PROTECTION,
  TS2_MPEG2TS_CRYPT_AES_CBC_PROTECTION,
  TS2_MPEG2TS_CRYPT_AES_CBC_BBTS20_PROTECTION,
  TS2_MPEG2TS_CRYPT_DVB_CSA_PROTECTION
}
 
enum  TS2_TrafficKeyParity {
  TS2_KEYPARITY_EVEN,
  TS2_KEYPARITY_ODD
}
 
enum  TS2_KsmInfoFlag {
  TS2_KIF_CURRENT_KEY = (1<<0),
  TS2_KIF_CURRENT_IV = (1<<1),
  TS2_KIF_NEXT_KEY = (1<<2),
  TS2_KIF_NEXT_IV = (1<<3),
  TS2_KIF_ACCESS_CRIT = (1<<4),
  TS2_KIF_TIMESTAMP = (1<<5),
  TS2_KIF_KEY_LIFETIME = (1<<6),
  TS2_KIF_PERMCATEGORY = (1<<7)
}
 

Functions

ATX_Result TS2_PacketEncrypter_Create (TS2_TrafficProtectionSystem protection, const ATX_Byte *drm_key, const ATX_Byte *cid_extension, ATX_Boolean is_service, ATX_UInt32 crypto_period, const ATX_Byte *traffic_seed, ATX_Size seed_size, ATX_UInt32 segment_start_index, const ATX_Byte *common_iv, ATX_Boolean single_key_layer, TS2_KSMT *ksmt, const ATX_Byte *access_criteria, ATX_Size access_criteria_size, TS2_PacketEncrypter **encrypter)
 
ATX_Result TS2_PacketEncrypter_ResetDrm (TS2_PacketEncrypter *self, const ATX_Byte *drm_key, const ATX_Byte *cid_extension, ATX_Boolean is_service, const ATX_Byte *access_criteria, ATX_Size access_criteria_size)
 
ATX_Result TS2_PacketEncrypter_UpdateKSMT (TS2_PacketEncrypter *self)
 
void TS2_PacketEncrypter_IncrementSegmentIndex (TS2_PacketEncrypter *self)
 
ATX_Result TS2_PacketEncrypter_Encrypt (TS2_PacketEncrypter *self, TS2_Packet *packet)
 
void TS2_PacketEncrypter_Destroy (TS2_PacketEncrypter *self)
 
ATX_Result TS2_KsmDecrypter_Create (const char *cid_base, TS2_CryptoInterface crypto, TS2_KsmDecrypterListener listener, TS2_TrafficProtectionSystem protection, ATX_UInt32 kdf_type, TS2_KsmDecrypter **decrypter)
 
ATX_Result TS2_KsmDecrypter_UpdateKSM (TS2_KsmDecrypter *self, const TS2_KSM *ksm)
 
void TS2_KsmDecrypter_Destroy (TS2_KsmDecrypter *self)
 
ATX_Result TS2_PacketDecrypter_Create (TS2_TrafficProtectionSystem protection, ATX_UInt32 kdf_type, const char *cid_base, TS2_DrmKeyResolver key_resolver, TS2_CryptoInterface *crypto, TS2_PacketDecrypter **decrypter)
 
ATX_Result TS2_PacketDecrypter_UpdateKSM (TS2_PacketDecrypter *self, const TS2_KSM *ksm)
 
ATX_Result TS2_PacketDecrypter_Decrypt (TS2_PacketDecrypter *self, TS2_Packet *packet)
 
void TS2_PacketDecrypter_Destroy (TS2_PacketDecrypter *self)
 
ATX_Result TS2_ProtectionKeyMap_Create (TS2_ProtectionKeyMap **key_map)
 
ATX_Result TS2_ProtectionKeyMap_SetKey (TS2_ProtectionKeyMap *self, const char *content_id, const ATX_Byte *key)
 key length is TS2_PROTECTION_KEY_LENGTH More...
 
const ATX_Byte * TS2_ProtectionKeyMap_GetKey (const TS2_ProtectionKeyMap *self, const char *content_id)
 
TS2_DrmKeyResolver TS2_ProtectionKeyMap_GetResolver (TS2_ProtectionKeyMap *self)
 
void TS2_ProtectionKeyMap_Destroy (TS2_ProtectionKeyMap *self)
 
ATX_Result TS2_GenerateTrafficKey (const ATX_Byte *seed, ATX_Size seed_size, ATX_UInt32 index, ATX_Byte *traffic_key)
 
ATX_Result TS2_GenerateInitializationVector (const ATX_Byte *seed, ATX_Size seed_size, ATX_UInt32 index, ATX_Byte *iv)
 

Macro Definition Documentation

#define TS2_Crypto_CreateSecretAesCbcDecrypter (   self,
  a,
  b,
  c,
 
)    self.CreateSecretAesCbcDecrypter(self.instance,a,b,c,d)
#define TS2_Crypto_EqualSecret (   self,
  a,
  b,
 
)    self.EqualSecret(self.instance,a,b,c)
#define TS2_Crypto_ExportSecret (   self,
  a,
  b,
 
)    self.ExportSecret(self.instance,a,b,c)
#define TS2_Crypto_GetDrmKey (   self,
  a,
 
)    self.GetDrmKey(self.instance,a,b)

Convenience macros.

#define TS2_Crypto_GetKeyFormat (   self,
  a,
 
)    self.GetKeyFormat(self.instance,a,b)
#define TS2_Crypto_GetMacKey (   self,
  a,
  b,
  c,
 
)    self.GetMacKey(self.instance,a,b,c,d)
#define TS2_Crypto_ReleaseSecret (   self,
 
)    self.ReleaseSecret(self.instance,a)
#define TS2_Crypto_TruncatedSha1 (   self,
  in_key,
  out_key 
)    self.TruncatedSha1(self.instance,in_key,out_key)
#define TS2_Crypto_UnwrapSecret (   self,
  a,
  b,
  c,
 
)    self.UnwrapSecret(self.instance,a,b,c,d)
#define TS2_PROTECTION_KEY_LENGTH   16
#define TS2_SecretAesCbcDecrypter_Decrypt (   self,
  a,
  b,
 
)    self->Decrypt(self->instance,a,b,c)

Convenience macros.

#define TS2_SecretAesCbcDecrypter_Destroy (   self)    self->Destroy(self)

Typedef Documentation

typedef struct TS2_Secret TS2_Secret

An opaque data structure defined by an implementation of the TS2_CryptoInterface.

Enumeration Type Documentation

Enumerator
TS2_KIF_CURRENT_KEY 
TS2_KIF_CURRENT_IV 
TS2_KIF_NEXT_KEY 
TS2_KIF_NEXT_IV 
TS2_KIF_ACCESS_CRIT 
TS2_KIF_TIMESTAMP 
TS2_KIF_KEY_LIFETIME 
TS2_KIF_PERMCATEGORY 

Traffic key format identifiers.

Enumerator
TS2_KEYFORMAT_CLEAR 
TS2_KEYFORMAT_SKB 
Enumerator
TS2_KEYPARITY_EVEN 
TS2_KEYPARITY_ODD 
Enumerator
TS2_NO_TRAFFIC_PROTECTION 
TS2_UNSUPPORTED_TRAFFIC_PROTECTION 
TS2_MPEG2TS_CRYPT_AES_CBC_PROTECTION 
TS2_MPEG2TS_CRYPT_AES_CBC_BBTS20_PROTECTION 
TS2_MPEG2TS_CRYPT_DVB_CSA_PROTECTION 

Function Documentation

ATX_Result TS2_GenerateInitializationVector ( const ATX_Byte *  seed,
ATX_Size  seed_size,
ATX_UInt32  index,
ATX_Byte *  iv 
)
ATX_Result TS2_GenerateTrafficKey ( const ATX_Byte *  seed,
ATX_Size  seed_size,
ATX_UInt32  index,
ATX_Byte *  traffic_key 
)
ATX_Result TS2_KsmDecrypter_Create ( const char *  cid_base,
TS2_CryptoInterface  crypto,
TS2_KsmDecrypterListener  listener,
TS2_TrafficProtectionSystem  protection,
ATX_UInt32  kdf_type,
TS2_KsmDecrypter **  decrypter 
)
void TS2_KsmDecrypter_Destroy ( TS2_KsmDecrypter self)
ATX_Result TS2_KsmDecrypter_UpdateKSM ( TS2_KsmDecrypter self,
const TS2_KSM ksm 
)
ATX_Result TS2_PacketDecrypter_Create ( TS2_TrafficProtectionSystem  protection,
ATX_UInt32  kdf_type,
const char *  cid_base,
TS2_DrmKeyResolver  key_resolver,
TS2_CryptoInterface crypto,
TS2_PacketDecrypter **  decrypter 
)
ATX_Result TS2_PacketDecrypter_Decrypt ( TS2_PacketDecrypter self,
TS2_Packet packet 
)
void TS2_PacketDecrypter_Destroy ( TS2_PacketDecrypter self)
ATX_Result TS2_PacketDecrypter_UpdateKSM ( TS2_PacketDecrypter self,
const TS2_KSM ksm 
)
ATX_Result TS2_PacketEncrypter_Create ( TS2_TrafficProtectionSystem  protection,
const ATX_Byte *  drm_key,
const ATX_Byte *  cid_extension,
ATX_Boolean  is_service,
ATX_UInt32  crypto_period,
const ATX_Byte *  traffic_seed,
ATX_Size  seed_size,
ATX_UInt32  segment_start_index,
const ATX_Byte *  common_iv,
ATX_Boolean  single_key_layer,
TS2_KSMT ksmt,
const ATX_Byte *  access_criteria,
ATX_Size  access_criteria_size,
TS2_PacketEncrypter **  encrypter 
)
void TS2_PacketEncrypter_Destroy ( TS2_PacketEncrypter self)
ATX_Result TS2_PacketEncrypter_Encrypt ( TS2_PacketEncrypter self,
TS2_Packet packet 
)
void TS2_PacketEncrypter_IncrementSegmentIndex ( TS2_PacketEncrypter self)
ATX_Result TS2_PacketEncrypter_ResetDrm ( TS2_PacketEncrypter self,
const ATX_Byte *  drm_key,
const ATX_Byte *  cid_extension,
ATX_Boolean  is_service,
const ATX_Byte *  access_criteria,
ATX_Size  access_criteria_size 
)
ATX_Result TS2_PacketEncrypter_UpdateKSMT ( TS2_PacketEncrypter self)
ATX_Result TS2_ProtectionKeyMap_Create ( TS2_ProtectionKeyMap **  key_map)
void TS2_ProtectionKeyMap_Destroy ( TS2_ProtectionKeyMap self)
const ATX_Byte* TS2_ProtectionKeyMap_GetKey ( const TS2_ProtectionKeyMap self,
const char *  content_id 
)
TS2_DrmKeyResolver TS2_ProtectionKeyMap_GetResolver ( TS2_ProtectionKeyMap self)
ATX_Result TS2_ProtectionKeyMap_SetKey ( TS2_ProtectionKeyMap self,
const char *  content_id,
const ATX_Byte *  key 
)

key length is TS2_PROTECTION_KEY_LENGTH