Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:PS3 PKG

From ReverseEngineering.wiki
Format
Platforms Platform:PlayStation 3, Platform:PlayStation Portable, Platform:PlayStation Vita
Magic 7F 50 4B 47
Extensions .pkg
Endianness big
On this wiki Facts · Code · Notes · Topics

Install package of the PlayStation 3 (and PSP/Vita on the same container): magic 7F 50 4B 47 (\x7FPKG), a big-endian header with content ID, item count and data offset, then a metadata block and an encrypted table of file entries and file data.

Overview

A .pkg is a flat container of files that the console installs. Public structure only; the encryption keys are not documented here.

Header

PSL1GHT tools/sfo_pkg/pkg.c (header 0x80 bytes, all fields big-endian):

Offset Size Field
0x00 4 magic 7F 50 4B 47
0x04 4 type (PSL1GHT writes 1; RPCS3 reads this as u16 release type then u16 platform: 0x8000 release, 0 debug; platform 1 PS3, 2 PSP/Vita)
0x08 4 offset of package info / metadata (0xC0 for PS3, 0x280 for PSP and Vita)
0x0C 4 unknown
0x10 4 header size (0x80)
0x14 4 item count
0x18 8 total package size
0x20 8 data offset
0x28 8 data size
0x30 0x30 content ID, e.g. UP0001-NPXX00000_00-...
0x60 0x10 QA digest
0x70 0x10 K licensee / nonce

PSP and Vita packages add an extended header (magic 7F 65 78 74, \x7Fext).

File entries

A table of 0x20-byte entries at the data offset (after decryption): name offset u32, name size u32, file offset u64, file size u64, type u32, padding u32. Type values (RPCS3): 1 NPDRM, 2 NPDRM EDAT, 3 regular, 4 folder, 6 unknown, 9 SDAT; bit 0x80000000 overwrite, 0x10000000 PSP file.

Metadata

Metadata items carry DRM type, content type, package type, package size, title ID and install directory. Content type values include 4 game data, 5 game exec, 6 PS1 emulator, 9 theme, 0xB license, 0x15 PSP2 game data and 0x16 PSP2 add-on content.

PS Vita packages (Vita3K, plain header only)

Vita3K's PkgHeader is 0xC0 bytes, big endian: magic at 0, u16 revision at 4, u16 type at 6, info_offset 8, info_count 0xC, header_size 0x10, file_count 0x14, total_size 0x18, data_offset 0x20, data_size 0x28, content_id (0x30 bytes, e.g. EP0000-PCSE00000_00-...; characters 7 to 15 are the 9-character title id) at 0x30, then digest, IV and signature fields, followed by an extension header with magic 7F 65 78 74. Info items at info_offset are u32 type, u32 size, payload; type 2 carries the content type (0x15 app, 0x16 DLC, 0x1F theme), 13 the items offset, 14 the PARAM.SFO offset and size. File entries are 0x20 bytes: name offset u32, name size u32, data offset u64, data size u64, type u32, padding; type & 0xFF of 4 or 18 is a directory. See Fact:PS3 PKG/struct/Vita PKG plain header (Vita3K). Key and decryption material is deliberately not recorded on this wiki.

Pitfalls

  • Entry and data tables are encrypted; the public tools differ in how they build debug versus retail packages.
  • The name PKG is shared with other platforms; check the magic.

Code & repositories

See Platform:PlayStation 3; Format:PSF (PARAM.SFO) sits inside the package.

  • https://github.com/ps3dev/PSL1GHT @ f649a08fd536a9e27c08c7db2d93a2d7ee4c3bbe · license: MIT
    PS3 homebrew SDK (MIT): fself, sprxlinker, sfo and pkg tools
    Tested on: source read, not run: source read, tools/ at the pinned commit · checked 2026-10-18; last activity 2026-10-08
  • https://github.com/RPCS3/rpcs3 @ cbfcf1f6b5de6aed8db54b9a59a5e99b9277e2b3 · license: GPL-2.0-only (declared by the contributor for the files used; GitHub reports GPL-2.0 for the repository)
    PS3 emulator (GPL-2.0): Crypto/unself.h, unpkg.h, Loader/PSF.h and PPUModule.cpp document SELF, PKG, SFO and SPRX import structures
    Tested on: source read, not run: headers read through a summarising fetch, not cloned · checked 2026-10-18; last activity 2026-10-17
  • https://github.com/Vita3K/Vita3K @ 7059dc2a40f1e416ce5403de31db209c75018f99 · license: GPL-2.0 (declared by the contributor; GitHub's detector did not recognize COPYING.txt)
    PS Vita emulator (GPL-2.0): vita3k/packages pkg.h/pkg.cpp (plain PKG header, info items) and sfo.h/sfo.cpp (SFO parser)
    Tested on: source read, not run: source read, not run; raw files fetched at the pinned commit · checked 2026-10-19