------------- Moves ecm_generator to media_cas_packager_sdk/internal. ------------- Add a simple TCP server listening on a port. My intention is to use this server to support the Simulcrypt APIs (TODO). Also add a simple TCP client binary for testing the server and also demo how to call the Simulcrypt APIs (TODO). ------------- If only a single key is in the ECM, it is the EVEN key. To make the code matches this understanding, change a parameter from 'false' to 'true'. But this change has NO impact on the produced ECM, regardless this parameter is 'false' or 'true' (i.e., whether using push_front or push_back), only a single key is in the ECM. ------------- Add classes that process Simulcrypt ECMG messages 1) Stream_set-up 2) CW_provision ------------- Renames server and client binaries. ------------- Make ecmg call ecm_generator to generate ecm. The return of the ecm to Simulcrypt caller will be implemented in the next CL. For now, using the 'key' (control word) in CW_provision message also as the 'key_id'. ------------- Move common folder ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=217358698
167 lines
4.6 KiB
C++
167 lines
4.6 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2018 Google LLC.
|
|
//
|
|
// This software is licensed under the terms defined in the Widevine Master
|
|
// License Agreement. For a copy of this agreement, please contact
|
|
// widevine-licensing@google.com.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Example Simulcrypt messages used in unit tests and example client.
|
|
|
|
#ifndef MEDIA_CAS_PACKAGER_SDK_EXAMPLE_TEST_SIMULCRYPT_MESSAGES_H_
|
|
#define MEDIA_CAS_PACKAGER_SDK_EXAMPLE_TEST_SIMULCRYPT_MESSAGES_H_
|
|
|
|
namespace widevine {
|
|
namespace cas {
|
|
|
|
const char kTestEcmgStreamSetupMessage[] = { // protocol_version
|
|
'\x01',
|
|
// message_type - Stream_set-up
|
|
'\x01', '\x01',
|
|
// message_length
|
|
// 18 bytes below, 3 parameters 6 bytes each
|
|
'\x00', '\x12',
|
|
// parameter_type - ECM_channel_id
|
|
'\x00', '\x0e',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x01',
|
|
// parameter_type - ECM_stream_id
|
|
'\x00', '\x0f',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x02',
|
|
// parameter_type - nominal_CP_duration
|
|
'\x00', '\x10',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x03'};
|
|
|
|
const char kTestEcmgCwProvisionMessageWithOneCw[] = {
|
|
// protocol_version
|
|
'\x01',
|
|
// message_type - CW_provision
|
|
'\x02', '\x01',
|
|
// message_length
|
|
// 64 bytes below, 3 * 6 + 8 + 10 + 1 * 22 + 6
|
|
'\x00', '\x40',
|
|
// parameter_type - ECM_channel_id
|
|
'\x00', '\x0e',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x01',
|
|
// parameter_type - ECM_stream_id
|
|
'\x00', '\x0f',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x02',
|
|
// parameter_type - CP_number
|
|
'\x00', '\x12',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\xa1',
|
|
// parameter_type - access_criteria
|
|
'\x00', '\x0d',
|
|
// parameter_length
|
|
'\x00', '\x04',
|
|
// parameter_value
|
|
'\x00', '\x00', '\x00', '\x00',
|
|
// parameter_type - CW_encryption
|
|
'\x00', '\x18',
|
|
// parameter_length
|
|
'\x00', '\x06',
|
|
// parameter_value
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
// parameter_type - CP_CW_combination
|
|
'\x00', '\x14',
|
|
// parameter_length - 2 + 16
|
|
'\x00', '\x12',
|
|
// parameter_value - CP then CW
|
|
// CP
|
|
'\x00', '\xa1',
|
|
// CW (16 bytes)
|
|
'\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11',
|
|
'\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11',
|
|
// parameter_type - CP_duration
|
|
'\x00', '\x13',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x0a'};
|
|
|
|
const char kTestEcmgCwProvisionMessageWithTwoCw[] = {
|
|
// protocol_version
|
|
'\x01',
|
|
// message_type - CW_provision
|
|
'\x02', '\x01',
|
|
// message_length
|
|
// 86 bytes below, 3 * 6 + 8 + 10 + 2 * 22 + 6
|
|
'\x00', '\x56',
|
|
// parameter_type - ECM_channel_id
|
|
'\x00', '\x0e',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x01',
|
|
// parameter_type - ECM_stream_id
|
|
'\x00', '\x0f',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x02',
|
|
// parameter_type - CP_number
|
|
'\x00', '\x12',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\xa1',
|
|
// parameter_type - access_criteria
|
|
'\x00', '\x0d',
|
|
// parameter_length
|
|
'\x00', '\x04',
|
|
// parameter_value
|
|
'\x00', '\x00', '\x00', '\x00',
|
|
// parameter_type - CW_encryption
|
|
'\x00', '\x18',
|
|
// parameter_length
|
|
'\x00', '\x06',
|
|
// parameter_value
|
|
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
|
|
// parameter_type - CP_CW_combination
|
|
'\x00', '\x14',
|
|
// parameter_length - 2 + 16
|
|
'\x00', '\x12',
|
|
// parameter_value - CP then CW
|
|
// CP
|
|
'\x00', '\xa1',
|
|
// CW (16 bytes)
|
|
'\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11',
|
|
'\x11', '\x11', '\x11', '\x11', '\x11', '\x11', '\x11',
|
|
// parameter_type - CP_CW_combination
|
|
'\x00', '\x14',
|
|
// parameter_length - 2 + 16
|
|
'\x00', '\x12',
|
|
// parameter_value - CP then CW
|
|
// CP
|
|
'\x00', '\xa2',
|
|
// CW (16 bytes)
|
|
'\x22', '\x22', '\x22', '\x22', '\x22', '\x22', '\x22', '\x22', '\x22',
|
|
'\x22', '\x22', '\x22', '\x22', '\x22', '\x22', '\x22',
|
|
// parameter_type - CP_duration
|
|
'\x00', '\x13',
|
|
// parameter_length
|
|
'\x00', '\x02',
|
|
// parameter_value
|
|
'\x00', '\x0a'};
|
|
|
|
} // namespace cas
|
|
} // namespace widevine
|
|
|
|
#endif // MEDIA_CAS_PACKAGER_SDK_EXAMPLE_TEST_SIMULCRYPT_MESSAGES_H_
|