EDAT files: Difference between revisions

From PS3 Developer wiki
Jump to navigation Jump to search
No edit summary
 
(32 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Software]]{{Wikify}}
EDATA is a file format used on PSP and PS3 to store encrypted data. There is also on PS3 only the SDATA file format which is very similar to EDATA (to detail). This page is for now about PS3 EDATA/SDATA only.
 
= Info on the talk page =


=Info on the talk page=
'''Info on the talk page''': please digest the info and move it here'''
'''Info on the talk page''': please digest the info and move it here'''


'''The info on this page is an extract of conversations, forum posts and from the talk page.
= Location =
 
===Decryption of EDATS===
 
Three ways to do it:
* act.dat,rif,idps combo
* rap
* free content (npdrm1 klic)
 
====Free Content====


Simply decrypted with appldr keys and free klic
EDAT files are stored under .edat extension. They are often packed in NPDRM [[PKG files]], downloaded from PS Store then extracted to the PS3 HDD. There are also PSP EDAT files which have a different format (to document).


====Using RAP====
= Structure (Encrypted Format) =


Overview of steps:
== Header ==


* Obtain rifkey from rap ([http://pastie.org/private/pmnmsnqg6zbfnk9xactbw flatz's rap2rifkey])
* Decrypt EDAT using corresponding klic (minis,psxclassics,etc) and rifkey
====='''Structure (Encrypted Format)'''=====
{| class="wikitable" style="text-align: center;"
{| class="wikitable" style="text-align: center;"
|-
|-
| style="background-color:#EDAEDA; color:#FFFFFF;" |
! style="background-color:#ffffff; border-left:1px solid #ffffff; border-top:1px solid #ffffff;" |
| style="background-color:#123EDA; color:#FFFFFF;" |'''Offset''' 
! Offset !! Name !! Size !! Type !! Notes
| style="background-color:#123EDA; color:#FFFFFF;" |'''Name'''
| style="background-color:#123EDA; color:#FFFFFF;" |'''Size'''
| style="background-color:#123EDA; color:#FFFFFF;" |'''Type'''
| style="background-color:#123EDA; color:#FFFFFF;" |'''Note'''
|-
| rowspan="19" style="background-color:#123EDA; color:#FFFFFF;" |'''Header'''
|-
| 0x00  || magic      || 4      || uint32 ||"NPD" (4E 50 44 00)
|-
| 0x04  || version    || 4      || uint32 ||
*01
*02
*03
*04
|-
| 0x08  || [[License_Types|License Types]]      || 4      || uint32 || for PS2 edat, the FW requires it to be with activation (also a.k.a. Paid content paired with your individual data)
for [[PKG_files#Misc.2FNote|PS1 PKG]], the FW 4.00 introduced some changes for installing them in regard of the EDAT license type.
*00 Debug / SDAT
*01 Network License: requires network authentication every time . [http://en.wikipedia.org/wiki/PlayStation_Network_outage#Inability_to_use_PlayStation_3_content See inability example]
*02 Local License: requires first time activation on-line (paid content but also demo & free of charge content).
*03 Free License: without license check.
|-
| 0x0B  || Application Type   || 4 || uint32 ||
*00
*01 (only theme/avatar/activation key, come with only PS3LOGO.DAT. [[PKG_files#File_Header_2|PKG items count]] is 0x02) and PS2 EDAT ([http://www.ps3devwiki.com/ps3/Iso.bin.edat#About_PS2_Classics Iso.bin.edat])
|-
| 0x10  || [[PARAM.SFO#CONTENT_ID|CONTENT ID]]    || 48 (0x30) || uint8 || Content Identificator
|-
| 0x40  || Digest        || 16 (0x10) || uint8 || QA digest (seems like to be a SHA-1 hash of the non-finalized file) : hash of the original data which is unknown until the whole file is read, can not be used as check. Can be used as watermark or zeroed on forged file.
|-
| 0x50  || NPD hash 1    || 16 (0x10) || uint8 || CID-FN hash (an AES CMAC hash of concatenation of Content ID and File Name using the third [[Keys#NPDRM_OMAC_Keys|NPDRM OMAC key]] as CMAC key)
|-
| 0x60  || NPD hash 2    || 16 (0x10) || uint8 || header hash (an AES CMAC hash of the 0x60 bytes from the beginning of file using xored bytes of the first [[Keys#NPDRM_OMAC_Keys|NPDRM OMAC key]] and the second NPDRM OMAC key as CMAC key)
|-
|-
| 0x70  || Activation time || 8  || unkn || Start of the validity period, filled with 00 if not used.
! rowspan="10" | Header
|-
|-
| 0x78  || Activation time || || unkn || End of the validity period,  filled with 00 if not used.
| 0x0 || NPD || 0x80 || PS3_NPD || See [[NPD]].
|-
|-
| 0x80   || NPD type      || 1 || uint8 || (Separated from Metadata type for wiki format)
| 0x80 || Type || 1 || ?uint8_t? || (separated from Metadata type for wiki format)
*00 Finalized EDAT
*00: EDAT
*01 Finalized SDAT
*01: SDAT
*80 Non Finalized EDAT
*80: Non Finalized (unsigned)
*81 Non Finalized SDAT
|-
|-
| 0x83  || Metadata type     || 3 || uint8 || (Flags description from talk page)
| 0x81 || Metadata type || 3 || ?uint8_t[3]? || (Outdated Flags description from talk page)
*00
*00
*01 Compressed?
*01: Compressed?
*02 Plain text?
*02: Plain text?
*03 Compressed plain text?
*03: Compressed plain text?
*05 Compressed?
*05: Compressed?
*06 Plain text?
*06: Plain text?
*07 Compressed plain text?
*07: Compressed plain text?
*0C ?
*0C: ?
*0D Compressed data?  
*0D: Compressed data?
*3C data/misc?  
*3C: Data/misc?
|-
| 0x84  || Segment size      || 4 || uint8 || default block is 16384 bytes = 0x4000. Seen also 0x8000.
|-
|-
| 0x88  || Data size         || || uint8 || decoded data size
| 0x84 || Block size || 4 || uint32_t || Default block size is 16 KB (0x4000 bytes). Max block size is 32 KB (0x8000 bytes). Working block sizes are: 1, 2, 4, 8, 16, 32 KB.
|-
|-
| 0x90  || meta data sections hash    || 16 (0x10)  || ||  
| 0x88 || Data size || 8 || uint64_t || Decoded data size.
|-
|-
| 0xA0  || extended header hash || 16 (0x10|| || An AES CMAC hash of 160 bytes from the beginning of file) uses the hash key as CMAC key and it depends on the file flags and keys
| 0x90 || Metadata sections hash || 0x10 || uint8_t[0x10] ||  
|-
|-
| 0xB0  || Unknown data?    || 40 (0x28)  || || Possible another unknown signature: zeroed on forged file
| 0xA0 || Extended header hash || 0x10 || uint8_t[0x10] || AES-CMAC hash of 160 bytes from the beginning of EDAT file. It uses the hash key as AES-CMAC key and it depends on the file flags and keys. ?What does this mean, see make_npdata by Hykem?
|-
|-
| 0xD8  || ECDSA signature   || 40 (0x28|| || Enabled (only?) for PS2 classic: all custom firmwares are patched to skip the ECDSA check. Zeroed on forged file.
| 0xB0 || ECDSA Metadata signature || 0x28 || uint8_t[0x28] || ECDSA curve type is vsh type 2. ECDSA public key is vsh public key (to check). It can be zeroed on forged file.
|-
|-
| colspan=6 style="background-color:#010EDA; color:#FFFFFF;" |     
| 0xD8 || ECDSA Header signature || 0x28) || uint8_t[0x28] || ECDSA curve type is vsh type 2. ECDSA public key is vsh public key (to check). Enabled (only?) for PS2 classic contents: all PS3 CFWs are patched to skip the ECDSA signature check. It can be zeroed on forged file.
|-
|-
| rowspan="21" style="background-color:#123EDA; color:#FFFFFF;" |'''Body'''
! colspan=6 |    
|-
|-
| 0x100  || Encrypted file      || Variable  ||  || The file is encrypted using  an AES algorithm in CBC mode
! rowspan="3" | Body
|-
|-
| 0x**  || Padding    || Variable   || ||
| 0x100 || Encrypted file || Variable || uint8_t[variable] || The file is encrypted using AES128CBC.
|-
|-
| 0x** || Padding || Variable || uint8_t[variable] || Aligned on ?? bytes.
|}
|}


====='''Footer Structure (Encrypted Format)'''=====
== Footer ==
 
{| class="wikitable" style="text-align: center;"
{| class="wikitable" style="text-align: center;"
|-
|-
! style="background-color:#123EDA; color:#FFFFFF;" |Description || style="background-color:#123EDA; color:#FFFFFF;" |Size || style="background-color:#123EDA; color:#FFFFFF;" |Note
! Description || Size || Notes
|-
|-
| Name   || 5 || "EDATA" or "SDATA"
| Name || 5 || "EDATA" or "SDATA"
|-
|-
| Space   || 1 || 0x20
| Space character || 1 || ' ' = 0x20
|-
|-
| Revision Version? || 8 ||
| Packager Version || 8 ||
*Version 1: "packager"
*Version 1: "packager"
*Version 2: "2.4.0.L "
*Version 2: "2.4.0.L "
*Version 2: "2.4.0.W "
*Version 2: "2.4.0.W "
*Version 2: "2.7.0.W "
*Version 2: "2.7.0.L "
*Version 2: "2.7.0.L "
*Version 3: "3.1.0.W "
*Version 3: "3.3.0.L "
*Version 3: "3.3.0.L "
*Version 3: "3.3.0.W "
*Version 3: "3.3.0.W "
*Version 4: "4.4.0.L "
*Version 4: "4.0.0.L "
*Version 4: "4.4.0.W "
*Version 4: "4.0.0.W "
|-
|-
| End of the file || 2 || 00 00
| Padding || 2 || 00 00
|}
|}
----
 
Note: Applied for normal ps3 edats and minis.edat
The footer is plaintext. It seems that the footer is not present in some EDAT files version 1 (e.g. in some Ridge Racer 7 additional contents) although it should theoretically be present with version = "packager".
 
= EDAT Versions =
 
There are 4 PS3 EDAT (and NPD) format major versions:
* 1: compatible with SDK 2.1x or older. Supported since at least PS3 System Software version 1.01.
* 2: compatible with SDK 3.0x or older
* 3: compatible with SDK 3.7x or older
* 4: compatible with SDK ?.?? or older. Supported since certainly some 4.0x System Software version.
 
= EDAT Extraction =
 
EDAT decryption, and complete verification, requires Klicensee. See [[NPDRM]].
 
= EDAT Generation =
 
To document.
 
= Tools =
 
== Official tools ==
 
=== make_edata_npdrm version 1.0.0 ===
 
Found in SCE PS3 SDK 1.92.
 
=== make_edata_npdrm version 2.7.0.W ===
 
make_edata_npdrm version 2.7.0.W (2009-08-18)
 
Found in SCE PS3 SDK 3.00.
 
=== make_edata_npdrm version 3.3.0.W ===
 
make_edata_npdrm version 3.3.0.W (2011-03-04)
 
Found in SCE PS3 SDK 3.60.
 
=== make_edata_npdrm version 4.0.0.W ===
 
make_edata_npdrm version 4.0.0.W (?date?)
 
Found in SCE PS3 SDK 4.75.
 
<pre>
make_edata_npdrm -h
make_edata_npdrm: version 4.0.0.W
usage:
  make_edata_npdrm [-options] <input file> <output file>
 
options:
  -h, --help    : print this usage and exit
  -v, --version  : print program version and exit
  -p, --progress : print progress [%]
 
  [create option]
  -b <size(KB)>  : block size (default 16, max 32)
  -z, --compress : data compress
 
  --format1      : old format (compatible with SDK 2.1x or older)
  --format2      : old format (compatible with SDK 3.0x or older)
  --format3      : old format (compatible with SDK 3.7x or older)
 
  [extract/check option]
  -x, --extract  : extract raw image from developing EDATA
  -i, --info    : print file information
</pre>
 
== Unofficial tools ==
 
=== make_npdata by Hykem ===
 
* [https://github.com/ErikPshat/make_npdata-hykem make_npdata by Hykem]
 
=== True Ancestor EDAT Rebuilder by JjKkYu ===
 
To document.
 
{{File Formats}}<noinclude>[[Category:Main]]</noinclude>

Latest revision as of 00:03, 15 June 2023

EDATA is a file format used on PSP and PS3 to store encrypted data. There is also on PS3 only the SDATA file format which is very similar to EDATA (to detail). This page is for now about PS3 EDATA/SDATA only.

Info on the talk page[edit | edit source]

Info on the talk page: please digest the info and move it here

Location[edit | edit source]

EDAT files are stored under .edat extension. They are often packed in NPDRM PKG files, downloaded from PS Store then extracted to the PS3 HDD. There are also PSP EDAT files which have a different format (to document).

Structure (Encrypted Format)[edit | edit source]

Header[edit | edit source]

Offset Name Size Type Notes
Header
0x0 NPD 0x80 PS3_NPD See NPD.
0x80 Type 1 ?uint8_t? (separated from Metadata type for wiki format)
  • 00: EDAT
  • 01: SDAT
  • 80: Non Finalized (unsigned)
0x81 Metadata type 3 ?uint8_t[3]? (Outdated Flags description from talk page)
  • 00
  • 01: Compressed?
  • 02: Plain text?
  • 03: Compressed plain text?
  • 05: Compressed?
  • 06: Plain text?
  • 07: Compressed plain text?
  • 0C: ?
  • 0D: Compressed data?
  • 3C: Data/misc?
0x84 Block size 4 uint32_t Default block size is 16 KB (0x4000 bytes). Max block size is 32 KB (0x8000 bytes). Working block sizes are: 1, 2, 4, 8, 16, 32 KB.
0x88 Data size 8 uint64_t Decoded data size.
0x90 Metadata sections hash 0x10 uint8_t[0x10]
0xA0 Extended header hash 0x10 uint8_t[0x10] AES-CMAC hash of 160 bytes from the beginning of EDAT file. It uses the hash key as AES-CMAC key and it depends on the file flags and keys. ?What does this mean, see make_npdata by Hykem?
0xB0 ECDSA Metadata signature 0x28 uint8_t[0x28] ECDSA curve type is vsh type 2. ECDSA public key is vsh public key (to check). It can be zeroed on forged file.
0xD8 ECDSA Header signature 0x28) uint8_t[0x28] ECDSA curve type is vsh type 2. ECDSA public key is vsh public key (to check). Enabled (only?) for PS2 classic contents: all PS3 CFWs are patched to skip the ECDSA signature check. It can be zeroed on forged file.
Body
0x100 Encrypted file Variable uint8_t[variable] The file is encrypted using AES128CBC.
0x** Padding Variable uint8_t[variable] Aligned on ?? bytes.

Footer[edit | edit source]

Description Size Notes
Name 5 "EDATA" or "SDATA"
Space character 1 ' ' = 0x20
Packager Version 8
  • Version 1: "packager"
  • Version 2: "2.4.0.L "
  • Version 2: "2.4.0.W "
  • Version 2: "2.7.0.W "
  • Version 2: "2.7.0.L "
  • Version 3: "3.1.0.W "
  • Version 3: "3.3.0.L "
  • Version 3: "3.3.0.W "
  • Version 4: "4.0.0.L "
  • Version 4: "4.0.0.W "
Padding 2 00 00

The footer is plaintext. It seems that the footer is not present in some EDAT files version 1 (e.g. in some Ridge Racer 7 additional contents) although it should theoretically be present with version = "packager".

EDAT Versions[edit | edit source]

There are 4 PS3 EDAT (and NPD) format major versions:

  • 1: compatible with SDK 2.1x or older. Supported since at least PS3 System Software version 1.01.
  • 2: compatible with SDK 3.0x or older
  • 3: compatible with SDK 3.7x or older
  • 4: compatible with SDK ?.?? or older. Supported since certainly some 4.0x System Software version.

EDAT Extraction[edit | edit source]

EDAT decryption, and complete verification, requires Klicensee. See NPDRM.

EDAT Generation[edit | edit source]

To document.

Tools[edit | edit source]

Official tools[edit | edit source]

make_edata_npdrm version 1.0.0[edit | edit source]

Found in SCE PS3 SDK 1.92.

make_edata_npdrm version 2.7.0.W[edit | edit source]

make_edata_npdrm version 2.7.0.W (2009-08-18)

Found in SCE PS3 SDK 3.00.

make_edata_npdrm version 3.3.0.W[edit | edit source]

make_edata_npdrm version 3.3.0.W (2011-03-04)

Found in SCE PS3 SDK 3.60.

make_edata_npdrm version 4.0.0.W[edit | edit source]

make_edata_npdrm version 4.0.0.W (?date?)

Found in SCE PS3 SDK 4.75.

make_edata_npdrm -h
make_edata_npdrm: version 4.0.0.W
usage:
  make_edata_npdrm [-options] <input file> <output file>

options:
  -h, --help     : print this usage and exit
  -v, --version  : print program version and exit
  -p, --progress : print progress [%]

  [create option]
  -b <size(KB)>  : block size (default 16, max 32)
  -z, --compress : data compress

  --format1      : old format (compatible with SDK 2.1x or older)
  --format2      : old format (compatible with SDK 3.0x or older)
  --format3      : old format (compatible with SDK 3.7x or older)

  [extract/check option]
  -x, --extract  : extract raw image from developing EDATA
  -i, --info     : print file information

Unofficial tools[edit | edit source]

make_npdata by Hykem[edit | edit source]

True Ancestor EDAT Rebuilder by JjKkYu[edit | edit source]

To document.