26 #include "AampClearKeyHelper.h"
34 const std::string AampClearKeyHelper::CLEARKEY_OCDM_ID =
"org.w3.clearkey";
38 return CLEARKEY_OCDM_ID;
47 initData = this->mInitData;
52 std::vector<std::string> keyIds = {CLEARKEY_KEY_ID};
54 if (jsonInitDataObj.
add(
"kids", keyIds))
56 jsonInitDataObj.
print(initData);
63 this->mInitData.assign(initData, initData + initDataLen);
65 mKeyID.assign(initData + CLEARKEY_DASH_KEY_ID_OFFSET, initData + CLEARKEY_DASH_KEY_ID_OFFSET + CLEARKEY_DASH_KEY_ID_LEN);
81 (void)keyID.insert(keyID.begin(), CLEARKEY_KEY_ID.begin(), CLEARKEY_KEY_ID.end());
89 if(licenseRequest.url.empty())
91 if (!mDrmInfo.
keyURI.empty())
95 licenseRequest.url = keyURI;
99 licenseRequest.url = challengeInfo.
url;
103 if (NULL != challengeInfo.
data)
105 licenseRequest.payload = challengeInfo.
data->getData();
116 std::vector<uint8_t> licenseResponseData(
reinterpret_cast<const char*
>(licenseResponse->getData().c_str()),
117 reinterpret_cast<const char*
>(licenseResponse->getData().c_str()) + licenseResponse->getDataLength());
119 std::vector<uint8_t> keyId(CLEARKEY_KEY_ID.begin(), CLEARKEY_KEY_ID.end());
123 keyInstance.
add(
"alg",
"cbc");
127 std::vector<AampJsonObject*> values = {&keyInstance};
130 keyObj.
add(
"keys", values);
131 std::string printedJson = keyObj.
print();
133 licenseResponse->setData((
unsigned char*)printedJson.c_str(), printedJson.length());
149 return std::make_shared<AampClearKeyHelper>(drmInfo,logObj);
156 systemIds.push_back(CLEARKEY_UUID);