fix: push type 2 encryption
This commit is contained in:
@@ -50,7 +50,27 @@ std::string DBDCrypt::encrypt(const std::string& data, const std::string& access
|
|||||||
return "DbdDAQEB" + b64Enc(fullPayload);
|
return "DbdDAQEB" + b64Enc(fullPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == TYPE_2)
|
||||||
|
{
|
||||||
|
auto transformedKey = transformCDNKey(CDN_KEY_BASE64);
|
||||||
|
|
||||||
|
std::string shiftedData = data;
|
||||||
|
for (char& c : shiftedData)
|
||||||
|
c = (char)((unsigned char)c - 1);
|
||||||
|
|
||||||
|
std::vector<uint8_t> padded(shiftedData.begin(), shiftedData.end());
|
||||||
|
int padLen = 16 - (padded.size() % 16);
|
||||||
|
if (padLen < 16) padded.insert(padded.end(), padLen, 0);
|
||||||
|
|
||||||
|
auto encryptedBody = aesECBEncrypt(padded, transformedKey);
|
||||||
|
if (encryptedBody.empty()) return "";
|
||||||
|
|
||||||
|
std::vector<uint8_t> fullPayload(encryptedBody.begin(), encryptedBody.end());
|
||||||
|
return "DbdDAgAC" + b64Enc(fullPayload);
|
||||||
|
}
|
||||||
|
|
||||||
if (type == TYPE_3)
|
if (type == TYPE_3)
|
||||||
|
|
||||||
{
|
{
|
||||||
auto decodedKey = b64Dec(accessKey);
|
auto decodedKey = b64Dec(accessKey);
|
||||||
if (decodedKey.empty()) return "";
|
if (decodedKey.empty()) return "";
|
||||||
|
|||||||
Reference in New Issue
Block a user