This is common with massive DLC packs (like Rock Band songs). Solution:
Once decrypted, you have raw files (EDAT, SELF, assets). You must place them in the correct directory structure that the PS3 expects.
Logic:
Example Directory Structure Output:
/dev_hdd0/game/BLUS12345/
└── USRDIR/
└── DLC/
└── data.bin
On an unmodified PS3 running official firmware (OFW), you never directly handle PKG files. Instead, you purchase DLC from the PlayStation Store, and the console downloads and installs the PKG file automatically in the background.
This is the most critical part. PS3 PKG files use AES-128 encryption (usually CTR mode).
Requirements:
Pseudo-Implementation:
#include <openssl/aes.h>void DecryptPkgData(uint8_t* input_data, uint8_t* output_data, size_t size, const uint8_t* key, const uint8_t* iv) AES_KEY aes_key; AES_set_decrypt_key(key, 128, &aes_key);
// PS3 PKG usually uses AES-128-CTR. OpenSSL requires specific handling for CTR mode. unsigned char iv_counter[AES_BLOCK_SIZE]; memcpy(iv_counter, iv, AES_BLOCK_SIZE); unsigned int num = 0; unsigned char ecount_buf[AES_BLOCK_SIZE]; memset(ecount_buf, 0, AES_BLOCK_SIZE); AES_ctr128_encrypt(input_data, output_data, size, &aes_key, iv_counter, ecount_buf, &num);
Logic Flow:
For preservationists and homebrew developers, you can repackage existing DLC into a PKG using tools like: Ps3 Dlc Pkg Files
Basic workflow: