Rights Information Files: Difference between revisions

From PS4 Developer wiki
Jump to navigation Jump to search
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Can be found in:
* See also [https://www.psdevwiki.com/ps3/RIF PSP, PS3 and PS Vita RIF files].
 
See also [[Rif/samples|Sample RIF files]].
 
== Location ==
 
The PS4 Rights Information Files and associated files can be found in:
* <code>/user/license/*.rif</code>, <code>/user/license/*.idx</code>
* <code>/user/license/*.rif</code>, <code>/user/license/*.idx</code>
* <code>/user/home/*/license/*.rif</code>, <code>/user/home/*/license/*.idx</code>
* <code>/user/home/*/license/*.rif</code>, <code>/user/home/*/license/*.idx</code>
Line 6: Line 12:
* <code>Sc0/license.dat</code> (in PKG entries)
* <code>Sc0/license.dat</code> (in PKG entries)


[[Rif/samples|Sample rif files]].
== RIF ==


== Rights Information Files ==
For a RIF file that is paired with an IDX file, see [[#RIFA File|RIFA file]].


For a rif file that is paired with an idx file, see [[#RIFA File|RIFA file]].
=== RIF Structure ===
 
=== RIF ===


Fields are big-endian.
Fields are big-endian.
Line 23: Line 27:
! style="width: 40%" | Remark
! style="width: 40%" | Remark
|-
|-
| Signature || <code>0x000</code> || 4 || <code>52 49 46 00</code> ('RIF\0') ||  
| Magic || <code>0x000</code> || 4 || <code>52 49 46 00</code> ('RIF\0') ||  
|-
|-
| Version || <code>0x004</code> || 2 || <code>00 01</code> || See [[#Type|Type]]
| Version || <code>0x004</code> || 2 || <code>00 01</code> || See [[#Type|Type]]
Line 29: Line 33:
| Unknown || <code>0x006</code> || 2 || <code>FF FF</code> ||  
| Unknown || <code>0x006</code> || 2 || <code>FF FF</code> ||  
|-
|-
| PSN Account ID || <code>0x008</code> || 8 || <code>AB CD EF 01 02 34 78 91</code> || 0 if not KDS RIF
| NP Account ID || <code>0x008</code> || 8 || <code>AB CD EF 01 02 34 78 91</code> || 0 if not KDS RIF
|-  
|-  
| Start Timestamp || <code>0x010</code> || 8 || <code>00 00 00 00 52 85 64 00</code> || Start timestamp (unix/epoch)
| Start Timestamp || <code>0x010</code> || 8 || <code>00 00 00 00 52 85 64 00</code> || Start timestamp (unix/epoch)
Line 39: Line 43:
| Type || <code>0x050</code> || 2 || <code>01 01</code> || See [[#Type|Type]]
| Type || <code>0x050</code> || 2 || <code>01 01</code> || See [[#Type|Type]]
|-
|-
| DRM Type || <code>0x052</code> || 2 || <code>00 0F</code> || Same as PKG DRM Type, PS5 Uses 00 10
| DRM Type || <code>0x052</code> || 2 || <code>00 0F</code> || Same as PKG DRM Type. PS5 Uses 00 10.
|-
|-
| Content Type || <code>0x054</code> || 2 || <code>00 1A</code> || Same as PKG Content TypePS5 Uses 00 20
| Content Type || <code>0x054</code> || 2 || <code>00 1A</code> || Same as PKG Content Type. PS5 Uses 00 20.
|-
|-
| SKU Flag || <code>0x056</code> || 2 || <code>00 01</code> || Not Bootable 0 Trial 1 Full Game 3
| SKU Flag || <code>0x056</code> || 2 || <code>00 01</code> || Not Bootable: 0, Trial: 1, Full Game: 3
|-
|-
| Extra Flags || <code>0x058</code> || 4 || <code>00 00 00 00</code> ||  
| Extra Flags || <code>0x058</code> || 4 || <code>00 00 00 00</code> ||  
Line 53: Line 57:
| Unknown || <code>0x068</code> || 3 || - ||
| Unknown || <code>0x068</code> || 3 || - ||
|-
|-
| Unknown || <code>0x06B</code> || 1 || - || 02 on old rifs (3.55), 03 on new rifs (5.00)
| Unknown || <code>0x06B</code> || 1 || - || 02 on old RIFs (3.55), 03 on new RIFs (5.00)
|-
|-
| Unknown || <code>0x06C</code> || 468 || - ||  
| Unknown || <code>0x06C</code> || 468 || - ||  
Line 61: Line 65:
| Secret Encryption IV || <code>0x260</code> || 16 || - || At least on debug/fake RIFs, this is the first 16 bytes of the SHA-256 hash of the Content ID (all 48 bytes including nulls)
| Secret Encryption IV || <code>0x260</code> || 16 || - || At least on debug/fake RIFs, this is the first 16 bytes of the SHA-256 hash of the Content ID (all 48 bytes including nulls)
|-
|-
| Encrypted Secret || <code>0x270</code> || 144 || - || See [[#Secret|Secret]] for when decrypted. On debug/fake rifs, the decrypted secret is empty except the first 16 bytes, which are the second 16 bytes of the Content ID hash.
| Encrypted Secret || <code>0x270</code> || 144 || - || See [[#Secret|Secret]] for when decrypted. On debug/fake RIFs, the decrypted secret is empty except the first 16 bytes, which are the second 16 bytes of the Content ID hash.
|-
|-
| RSA Signature || <code>0x300</code> || 256 || - || Verified using public key depending on type
| Signature || <code>0x300</code> || 256 || - || RSA2048 signature. Verified using public key depending on type
|}
|}


==== Type ====
=== Type ===


{| class="wikitable sortable"
{| class="wikitable sortable"
Line 152: Line 156:


=== Secret ===
=== Secret ===
* See also [https://psdevwiki.com/ps3/SELF_-_SPRX#Supplemental_Header_Table PS Vita shared secret on PS3 Dev Wiki] contained in some PS Vita SELF headers.
On debug/fake RIFs, the decrypted secret is empty except the first 16 bytes, which are the second 16 bytes of the Content ID hash.


{| class="wikitable sortable"
{| class="wikitable sortable"
Line 160: Line 168:
! style="width: 40%" | Remark
! style="width: 40%" | Remark
|-
|-
| Unknown || <code>0x00</code> || 16 || - ||  
| Content ID Hash || <code>0x00</code> || 16 || - || On debug/fake RIFs, this is the second 16 bytes of the Content ID hash.
|-
| Unknown || <code>0x10</code> || 16 || - ||
|-
|-
| Unknown || <code>0x20</code> || 16 || - ||  
| Padding || <code>0x10</code> || 32 || - || Zero byte padding (32 bytes)
|-
|-
| Content Key Seed || <code>0x30</code> || 16 || - || Used to generate PFS key
| Content Key Seed || <code>0x30</code> || 16 || - || Used to generate PFS key
Line 170: Line 176:
| SELF Key Seed || <code>0x40</code> || 16 || - || Used to generate SELF key
| SELF Key Seed || <code>0x40</code> || 16 || - || Used to generate SELF key
|-
|-
| Unknown || <code>0x50</code> || 16 || - ||  
| Unknown || <code>0x50</code> || 16 || - || Random 16 bytes of unknown purpose
|-
|-
| Unknown || <code>0x60</code> || 16 || - ||  
| Unknown || <code>0x60</code> || 16 || - || Random 16 bytes of unknown purpose
|-
|-
| Entitlement Key || <code>0x70</code> || 16 || - ||  
| Entitlement Key || <code>0x70</code> || 16 || - || Usually all zeroes. Used on Additional Content
|-
|-
| Unknown || <code>0x80</code> || 16 || - ||  
| Padding || <code>0x80</code> || 16 || - || Zero byte padding (16 bytes)
|}
|}


== RIFA File ==
== RIFA File ==


See also [[#RIDX Structure|RIDX structure]] for the paired idx file.
See also [[#RIDX Structure|RIDX structure]] for the paired IDX file.


When in this form, a [[#RIFA Header|RIFA header is present]], followed by sequential [[#RIF|rifs]].
When in this form, a [[#RIFA Header|RIFA header is present]], followed by sequential [[#RIF|RIFs]].


=== RIFA Header ===
=== RIFA Structure ===


Fields are big-endian.
Fields are big-endian.
Line 196: Line 202:
! style="width: 40%" | Remark
! style="width: 40%" | Remark
|-
|-
| Signature || <code>0x000</code> || 4 || <code>52 49 46 00</code> ('RIF\0') ||  
| Magic || <code>0x000</code> || 4 || <code>52 49 46 00</code> ('RIF\0') ||  
|-
|-
| [[Service ID]] || <code>0x004</code> || 48 || <code>IP9100-CUSA00001_00</code> || ''Size assumed''
| [[Service ID]] || <code>0x004</code> || 48 || <code>IP9100-CUSA00001_00</code> || ''Size assumed''
Line 205: Line 211:
== RIDX File ==
== RIDX File ==


=== RIDX Header ===
=== RIDX Structure ===


Fields are little-endian.
Fields are little-endian.
Line 216: Line 222:
! style="width: 40%" | Remark
! style="width: 40%" | Remark
|-
|-
| Signature || <code>0x00</code> || 4 || <code>78 64 69 72</code> ('xdir') ||  
| Magic || <code>0x00</code> || 4 || <code>78 64 69 72</code> ('xdir', meaning RIF index) ||  
|-
|-
| RIF Count || <code>0x04</code> || 4 || <code>01 00 00 00</code> ||  
| Entries Count || <code>0x04</code> || 4 || code>01 00 00 00</code>, <code>03 00 00 00</code> ||  
|-
|-
| Version || <code>0x08</code> || 1 || <code>01</code> || 1 (current)
| Version || <code>0x08</code> || 1 || <code>01</code> || 1 (current)
Line 224: Line 230:
| [[Service ID]] || <code>0x09</code> || 19 || <code>IP9100-CUSA00001_00</code> ||  
| [[Service ID]] || <code>0x09</code> || 19 || <code>IP9100-CUSA00001_00</code> ||  
|-
|-
| Unknown || <code>0x1C</code> || 4 || <code>01 00 00 00</code> ||
| Unknown || <code>0x1C</code> || 4 || code>01 00 00 00</code>, <code>00 00 00 00</code> ||
|-
|-
| Entries || <code>0x20</code> || 48 * RIF Count || - || See [[#RIDX Entry|RIDX entry]]
| Entries || <code>0x20</code> || 48 * Entries_Count || - || See [[#RIDX Entry|RIDX entry]]
|}
|}


Line 240: Line 246:
! style="width: 40%" | Remark
! style="width: 40%" | Remark
|-
|-
| [[Entitlement label]] || <code>0x00</code> || 16 || <code>PLAYROOM00000000</code> ||  
| [[Entitlement Label]] || <code>0x00</code> || 16 || <code>PLAYROOM00000000</code> ||  
|-
|-
| RIF Offset || <code>0x10</code> || 8 || <code>00 04 00 00 00 00 00 00</code> || Offset into [[#RIFA File|RIFA file]]
| RIF Offset || <code>0x10</code> || 8 || <code>00 04 00 00 00 00 00 00</code> || Offset into [[#RIFA File|RIFA file]]
Line 250: Line 256:
| Unknown || <code>0x21</code> || 1 || <code>00</code> ||
| Unknown || <code>0x21</code> || 1 || <code>00</code> ||
|-
|-
| RIF HMAC || <code>0x22</code> || 8 || - || First 8 bytes of HMACSHA256 of RIF data using per-console data as key
| RIF Digest || <code>0x22</code> || 8 || - || First 8 bytes of HMACSHA256 of RIF data using per-console data as key
|-
|-
| Unknown || <code>0x2A</code> || 6 || - ||  
| Unknown || <code>0x2A</code> || 6 || - ||  

Latest revision as of 01:36, 17 December 2024

See also Sample RIF files.

Location[edit | edit source]

The PS4 Rights Information Files and associated files can be found in:

  • /user/license/*.rif, /user/license/*.idx
  • /user/home/*/license/*.rif, /user/home/*/license/*.idx
  • /mnt/disc/license/rif
  • /preinst2/app/CUSA00001/app.rif
  • Sc0/license.dat (in PKG entries)

RIF[edit | edit source]

For a RIF file that is paired with an IDX file, see RIFA file.

RIF Structure[edit | edit source]

Fields are big-endian.

Name Offset Size Example Remark
Magic 0x000 4 52 49 46 00 ('RIF\0')
Version 0x004 2 00 01 See Type
Unknown 0x006 2 FF FF
NP Account ID 0x008 8 AB CD EF 01 02 34 78 91 0 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 48 IP9100-CUSA00001_00-PLAYROOM00000000
Type 0x050 2 01 01 See Type
DRM Type 0x052 2 00 0F Same as PKG DRM Type. PS5 Uses 00 10.
Content Type 0x054 2 00 1A Same as PKG Content Type. PS5 Uses 00 20.
SKU Flag 0x056 2 00 01 Not Bootable: 0, Trial: 1, Full Game: 3
Extra Flags 0x058 4 00 00 00 00
Unknown 0x060 4 00 02 00 00 PS5 Uses 00 00 00 00
Unknown 0x064 4 00 00 00 01
Unknown 0x068 3 -
Unknown 0x06B 1 - 02 on old RIFs (3.55), 03 on new RIFs (5.00)
Unknown 0x06C 468 -
Disc Key 0x240 32 -
Secret Encryption IV 0x260 16 - At least on debug/fake RIFs, this is the first 16 bytes of the SHA-256 hash of the Content ID (all 48 bytes including nulls)
Encrypted Secret 0x270 144 - See Secret for when decrypted. On debug/fake RIFs, the decrypted secret is empty except the first 16 bytes, which are the second 16 bytes of the Content ID hash.
Signature 0x300 256 - RSA2048 signature. Verified using public key depending on type

Type[edit | edit source]

Type FW Type Min Ver Max Ver Name Description Remarks
0x000 All 1 1 KDS (NPDRM) Used for digital content Revoked in at least 4.05
0x001 All 2 2
0x002 All 3 3
0x101 All 1 1 Isolated (Free,Kiosk) 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]

On debug/fake RIFs, the decrypted secret is empty except the first 16 bytes, which are the second 16 bytes of the Content ID hash.

Name Offset Size Example Remark
Content ID Hash 0x00 16 - On debug/fake RIFs, this is the second 16 bytes of the Content ID hash.
Padding 0x10 32 - Zero byte padding (32 bytes)
Content Key Seed 0x30 16 - Used to generate PFS key
SELF Key Seed 0x40 16 - Used to generate SELF key
Unknown 0x50 16 - Random 16 bytes of unknown purpose
Unknown 0x60 16 - Random 16 bytes of unknown purpose
Entitlement Key 0x70 16 - Usually all zeroes. Used on Additional Content
Padding 0x80 16 - Zero byte padding (16 bytes)

RIFA File[edit | edit source]

See also RIDX structure for the paired IDX file.

When in this form, a RIFA header is present, followed by sequential RIFs.

RIFA Structure[edit | edit source]

Fields are big-endian.

Name Offset Size Example Remark
Magic 0x000 4 52 49 46 00 ('RIF\0')
Service ID 0x004 48 IP9100-CUSA00001_00 Size assumed
Unknown 0x034 972 -

RIDX File[edit | edit source]

RIDX Structure[edit | edit source]

Fields are little-endian.

Name Offset Size Example Remark
Magic 0x00 4 78 64 69 72 ('xdir', meaning RIF index)
Entries Count 0x04 4 code>01 00 00 00, 03 00 00 00
Version 0x08 1 01 1 (current)
Service ID 0x09 19 IP9100-CUSA00001_00
Unknown 0x1C 4 code>01 00 00 00, 00 00 00 00
Entries 0x20 48 * Entries_Count - See RIDX entry

RIDX Entry[edit | edit source]

Fields are little-endian.

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 Digest 0x22 8 - First 8 bytes of HMACSHA256 of RIF data using per-console data as key
Unknown 0x2A 6 -