feat: add dbdcrypt
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// 9.5.2_live
|
||||
#define ACCESS_KEY "BGz7nwlRX8QP__fzvqrgpNRVqrlEyuY54vuGVAqDO_g="
|
||||
#define KEY_ID "9.5.2_live"
|
||||
|
||||
/*
|
||||
hardcoded variables (they have been the same since like 2017)
|
||||
*/
|
||||
#define CDN_KEY_BASE64 "lEQWeCt51ET+MIuxdTs7Ig/gzVZP2vdkVZA1BDfz+L0="
|
||||
#define CDN_UUID "6EF35759-454D-4EBC-8041-9A94CB99FD5D"
|
||||
|
||||
class DBDCrypt
|
||||
{
|
||||
public:
|
||||
enum PayloadType
|
||||
{
|
||||
NONE = 0,
|
||||
TYPE_1, // compressed
|
||||
TYPE_2, // CDN
|
||||
TYPE_3 // dyn / accesskey
|
||||
};
|
||||
|
||||
static std::string decrypt(const std::string& data, const std::string& accessKey,
|
||||
PayloadType* outType = nullptr);
|
||||
|
||||
static std::string encrypt(const std::string& data, const std::string& accessKey, PayloadType type,
|
||||
std::string keyId);
|
||||
|
||||
private:
|
||||
static std::string decType1(const std::string& data, const std::string& key, PayloadType* outType);
|
||||
static std::string decType2(const std::string& data, const std::string& key, PayloadType* outType);
|
||||
static std::string decType3(const std::string& data, const std::string& key, PayloadType* outType);
|
||||
|
||||
static std::string aesECBDecrypt(const std::vector<uint8_t>& cipherText, const std::vector<uint8_t>& key);
|
||||
static std::string aesECBEncrypt(const std::vector<uint8_t>& plainText, const std::vector<uint8_t>& key);
|
||||
|
||||
static std::vector<uint8_t> b64Dec(const std::string& input);
|
||||
static std::string b64Enc(const std::vector<uint8_t>& input);
|
||||
|
||||
static std::string zlibDecompress(const std::vector<uint8_t>& compressed);
|
||||
static std::vector<uint8_t> zLibCompress(const std::string& data);
|
||||
|
||||
static std::vector<uint8_t> transformCDNKey(const std::string& b64CDNKey);
|
||||
static std::string shiftKeyID(const std::string& id, int shift);
|
||||
};
|
||||
Reference in New Issue
Block a user