Well 1b87c6b551e518d11114ee21b7645a47.pkg - Encrypted main file contained list of avaible PKGs.
Structure only for this file:
Code: Select all
struct PKGHeader
{
WORD dwVersion; // 0x01 0x00
BYTE bEncryption; // ID of encrypt algorithm ( 1 - AES-128-CBC , 0 - BlowFish-CBC )
BYTE bFlag; // 6
DWORD dwDataSize;
};
Key generating automaticly
Code: Select all
const char * pPKGName = "1b87c6b551e518d11114ee21b7645a47.pkg";
int __cdecl FileSystem_Init(int bFlag, int bEncryption, const char *pPKGName, int pScrBuffer, int dwSize, int pDstBuffer)
{
int result;
char pKey[16] = { 0 };
if ( FileSystem_MakeKey((signed int)&bEncryption, (int)&pKey, pPKGName) == 1 )
{
result = FileSystem_Decrypt((int)&bFlag, pScrBuffer, dwSize, (int)&pKey, pDstBuffer);
}
else
{
printf("Error: Unable generate key!\n");
result = 0;
}
return result;
}
Default algorithm is AES-128 in CBC mode.
Code: Select all
FileSystem_Decrypt
static unsigned char pKey[16] = {0x51, 0xFE, 0xAA, 0x02, 0x43, 0x0A, 0xFE, 0xC6, 0xC2, 0x9E, 0x24, 0x24, 0x2B, 0x99, 0xFF, 0x77};
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);
cipher = EVP_aes_128_cbc();
EVP_DecryptInit(&ctx, cipher, pKey, 0);
EVP_DecryptUpdate(&ctx, pBuffer, (int*)&PKGHeader.dwSize, pBuffer, PKGHeader.dwSize);
EVP_DecryptFinal(&ctx, pBuffer, (int*)&PKGHeader.dwSize);
EVP_CIPHER_CTX_cleanup(&ctx);
And we get decrypted variant >
here
Other PKGs also encrypted with AES, Key and IV generated by other functions > it's MD5 + custom passwords >
kbuj37shgh&@4n!2; and
[wospo-02i after generating key and iv they converted to string and using as key and iv.