Content License
This page will have to be merged with the Rif one.
The PS4 content license files are, like on PSP, PS3 and PS Vita, the .rif files.
But for the first time, the format has changed a lot:
- There is only one .rif file (and .idx) per game/application. On PSP, PS3 and PS Vita, there was one .rif per content (one for the game and one for each DLC)
- This is handled by adding each DLC license to the game .rif. To determine where the license for a specific content is in the .rif, the PS4 generates a .idx file (RIF index).
- When the .rif is downloaded from PSN by SceShellCore, it is added to the current .rif file of the game (if existing).
Then the .idx is generated. SceShellCore calls npdrm_ioctl to get a 0x10 bytes HMAC-SHA256 per-console key from SAMU.
The HMAC is computed over the RIF data and is written to the .idx entry.
The aim is both to ensure .rif integrity and to make sure that the .rif and .idx cannot be copied to another PS4 console.
The files an be found in:
- For disc licenses:
/mnt/disc/license/rif
(on the BluRay) and/preinst2/app/CUSA00001/app.rif
(on the HDD) - For digital content licenses:
/user/license/*.rif
,/user/license/*.idx
- For another type of digital content licenses:
/user/home/*/license/*.rif
,/user/home/*/license/*.idx
RIF File[edit | edit source]
This is a .rif that is not paired with a .idx file.
For a RIF file that is paired with a .idx file, see RIFA file.
The .rif file embeds one or more RIF entry.
RIF Entry[edit | edit source]
Fields are big-endian. Each RIF entry is 0x400 bytes sized.
Name | Offset | Size | Example | Remark |
---|---|---|---|---|
Magic | 0x000 |
4 | 52 49 46 00 ('RIF\0') |
|
Version | 0x004 |
2 | 00 01 , 00 02 |
See RIF Type |
?DRM Type? | 0x006 |
2 | 00 02 for KDS, FF FF for disc |
|
PSN Account ID | 0x008 |
8 | AB CD EF 01 02 34 78 91 |
zeroed if not KDS RIF |
Start Timestamp | 0x010 |
8 | 00 00 00 00 52 85 64 00 |
Start timestamp (unix/epoch) |
End Timestamp | 0x018 |
8 | 7F FF FF FF FF FF FF FF |
End timestamp (unix/epoch), typically INT64_MAX |
Content ID | 0x020 |
0x30 | IP9100-CUSA00001_00-PLAYROOM00000000 |
|
RIF Type | 0x050 |
2 | 01 01 |
See RIF Type |
Unknown | 0x052 |
2 | 00 0F |
|
Unknown | 0x054 |
2 | 00 1A |
|
SKU Flag | 0x056 |
2 | 00 01 |
|
Extra Flags | 0x058 |
4 | 00 00 00 00 |
|
Unknown | 0x060 |
4 | 00 02 00 00 |
|
Unknown | 0x064 |
4 | 00 00 00 01 |
|
?RIF format revision? | 0x068 |
4 | 00 00 00 02 , 00 00 00 03 |
2 on old rifs (3.55), 3 on new rifs (5.00) |
Unknown | 0x06C |
2 | 00 02 |
|
Unknown | 0x06E |
0x1D2 | - | |
Disc Key | 0x240 |
0x20 | - | Not present in KDS RIFs |
Secret Encryption IV | 0x260 |
0x10 | - | |
Encrypted Secret | 0x270 |
0x90 | - | See Secret for when decrypted |
RSA Signature | 0x300 |
0x100 | - | Verified using public key depending on type |
RIF Type[edit | edit source]
Type | FW Type | Min Ver | Max Ver | Name | Description | Remarks |
---|---|---|---|---|---|---|
0x000
|
All | 1 | 1 | KDS | Used for digital content | Revoked in at least 4.05 |
0x001
|
All | 2 | 2 | |||
0x002
|
All | 3 | 3 | |||
0x101
|
All | 1 | 1 | Isolated | Used for truly free content (Playroom, Vue, Spotify) | |
0x302
| ||||||
0x102
|
All | 1 | 1 | Disc | Used for Blu-ray content | |
0x200
|
DEX/TEST | 1 | 1 | Fake/Debug | Used for testing/debugging | |
0x201
| ||||||
0x202
| ||||||
0x303
|
CEX | 1 | 1 | ? | ||
0x304
|
? (not CEX) | 1 | 1 | ? | ||
0x305
|
DEX/TEST | 1 | 1 | ? |
Secret[edit | edit source]
This structure corresponds to the decrypted form. Size is 0x90 bytes.
Name | Offset | Size | Example | Remark |
---|---|---|---|---|
Unknown | 0x00 |
0x10 | - | |
Zeroes? | 0x10 |
0x10 | - | |
Zeroes? | 0x20 |
0x10 | - | |
Content Key Seed | 0x30 |
0x10 | - | Used to generate PFS key |
SELF Key Seed | 0x40 |
0x10 | - | Used to generate SELF key |
Unknown | 0x50 |
0x10 | - | |
Unknown | 0x60 |
0x10 | - | |
Entitlement Key | 0x70 |
0x10 | - | Usually zeroes |
Zeroes? | 0x80 |
0x10 | - |
RIFA File[edit | edit source]
This RIF form is paired with a .idx file.
When in this form, contrarly to RIF files a RIFA header is present, followed by sequential RIF entries.
See also IDX structure for the paired .idx file.
RIFA Header[edit | edit source]
Fields are big-endian. Size is 0x400 bytes.
Name | Offset | Size | Example | Remark |
---|---|---|---|---|
Magic | 0x000 |
4 | 72 69 66 61 ("rifa") |
|
Service ID | 0x004 |
0x14 | IP9100-CUSA00001_00\0 |
Size assumed |
Unknown | 0x018 |
0x3D8 | full of zeroes |
IDX File[edit | edit source]
This is the RIF index file. It is used in pair with RIFA files.
RIF IDX[edit | edit source]
Fields are little-endian. Size is 0x20 bytes (header) + entries_count * 0x30 bytes (entry_size).
Name | Offset | Size | Example | Remark |
---|---|---|---|---|
Magic | 0x00 |
4 | 72 69 64 78 ("ridx") |
|
Entries count | 0x04 |
4 | 01 00 00 00 , 03 00 00 00 |
|
Version | 0x08 |
1 | 01 |
1 (current) |
Service ID | 0x09 |
19 | IP9100-CUSA00001_00 |
|
Unknown | 0x1C |
4 | 01 00 00 00 , 00 00 00 00 |
|
Entries | 0x20 |
0x30 * Entries Count | See RIF IDX entry |
RIF IDX Entry[edit | edit source]
Fields are little-endian. Size is 0x30 bytes.
Name | Offset | Size | Example | Remark |
---|---|---|---|---|
Entitlement Label | 0x00 |
16 | PLAYROOM00000000 |
|
RIF Offset | 0x10 |
8 | 00 04 00 00 00 00 00 00 |
Offset into RIFA file |
RIF Size | 0x18 |
8 | 00 04 00 00 00 00 00 00 |
|
Unknown | 0x20 |
1 | 01 |
|
Unknown | 0x21 |
1 | 00 |
|
RIF data HMAC-SHA256 | 0x22 |
8 | - | First 8 bytes of HMAC-SHA256 of RIF data using per-console data as key |
Unknown | 0x2A |
6 | - |