This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DLC Decryption
#1
So, after finishing reverse engineering the PRX, SAVEDATA and PGD encryption/decryption processes, it's time to attempt something even harder, DLC content...
Many users have been asking if this will be supported in JPCSP, so I've finally started working hard on this and already found some interesting information concerning the formats used by the PSP.
Hopefully, soon JPCSP will have the ability of decrypting and loading DLC content through the CryptoEngine and also applying custom signing methods to expired DLC (with the proper rights, of course).
I'm starting this thread to document and share my findings so far on this subject, so, enjoy!

---------------------------------------------------------------------------------------

DLC formats:
Code:
EDAT/SPRX format:

[HEADER]
0x00: 00 50 53 50   -> .PSP
0x04: 45 44 41 54   -> EDAT
0x08: 02 00 00 00   -> License type (0x2000000 paid content -> uses rif key  / 0x0000100 free content -> uses fixed key)
0x0C: 90 00            -> Data offset                
0x0E: 01                -> Data type (0 - EDAT / 1 - SPRX)
0x0F: 01                -> Version
0x10 - 0x40            -> Content ID (e.g.: JP0700-ULJS00237_00-EXTRAMISSION0001)
0x40                      -> Name hash
0x50 - 0x58            -> NULL
0x58 - 0x80            -> Signature
0x80                      -> Header hash
[/HEADER]

0x90: [Encrypted PRX (SPRX)] / [PGD (EDATA)]

Code:
RIF format:

0x00: 00 00 00 01      -> Version
0x04: 00 00 00 02      -> License type
0x08 - 0x10               -> Account ID (e.g.: B4 1F 2C 0B DC 1B 43 31)
0x10 - 0x40               -> Content ID (e.g.: UP900-UCUS98721_00-PATAPONPSNDEMO08)
0x40                         -> Index hash
0x50                         -> Header hash
0x60: 00 00 01 1F      -> License start time
0x64: C5 16 7B D8     -> License expiration time
0x68 - 0x70               -> NULL
0x70 - 0x90               -> Signature

Code:
ACT.DAT format:

0x00: 00 00 00 01   -> Version
0x04: 00 00 00 01   -> Unknown
0x08 - 0x10            -> Account ID (e.g.: B4 1F 2C 0B DC 1B 43 31)
0x10 - 0x1010         -> Data hashes' table
0x1010 - 0x1030     -> Signature


npdrm.prx:
Code:
sceNpDrmVerifyAct(int actdat_addr) - Calls sceDdrdbHash and sceDdrdbSigvry to verify the ACT.DAT file signature.

sceNpDrmVerifyRif(int rif_addr) - Verifies the specified .RIF license file signature with extra checks by using sceOpenPSIDGetPSID and the Unique ID (hardware addresses 0xBC100090 and 0xBC100094).

sceNpDrmGetModuleKey(int sprx_addr, int unk) - Decrypts and generates a SPRX module key.
-> Algorithm:
     - First, the SPRX file signature is verified in a similar way as it is done with the licensing files.
     - A new header hash is generated using the first 0x80 bytes of data and checked against the Header Hash in the file by using sceDrmBBMacFinal2.
     - sceNpDrmGetFixedKey is then called to build a decrypting key for this module.

scePspNpDrm_driver_04618D16(int out_addr) - Calls sceOpenPSIDGetOpenPSID(out_addr, 0x1).

sceNpDrmGetContentKey(int file_addr, int actdat_addr, int rif_addr) - Calls sceNpDrmGetVersionKey(int file_addr, int actdat_addr, int rif_addr, 0).

sceNpDrmGetVersionKey(int file_addr, int actdat_addr, int rif_addr, int unk) -  Decrypts and generates an EDATA key. Verifies the .RIF file, makes a call to sceMgMemoryStick_driver_735526D6() (unknown), and uses custom algorithms and private keys to process the key generation.

sceNpDrmGetFixedKey(int file_addr, int data_addr, int type_addr) - Generates a fixed key for any kind of data (mostly used by free content).
Checks the Name Hash against a private key and then proceeds to use custom algorithms and private keys to process the key generation.

sceNpDrmEdataGetDataSize(int file_addr) - Gets a file descriptor for file_addr with IoFileMgrForKernel_13A4DEB0(file_addr, 0x4) and calls sceIoIoctl(fd, 0x41000010, 0, 0, 0, 0) to obtain the data size.

sceNpDrmRenameCheck(int file_addr) - Checks if a DRM file has been renamed.
-> Algorithm:
     - Open the file with sceIoOpen(file_addr, 0x1, 0).
     - Read the EDATA header with sceIoRead(fd, buffer, 0x80).
     - Generate a new name hash and compare it with the one in the file:
           - sceDrmBBMacInit(ctx_addr, 0x3).
           - sceDrmBBMacUpdate(ctx_addr, buffer + 0x10, 0x30).
           - strlen(filename).
           - sceDrmBBMacUpdate(ctx_addr, filename, filename_size).
           - sceDrmBBMacFinal2(ctx_addr, buffer + 0x40, private_hash).
       The new hash is generated with the Content ID and the filename and is
       checked against a private known hash.

sceNpDrmEdataSetupKey(int edat_addr) - Obtains an .edat key for decryption.
This function gets a file descriptor with IoFileMgrForKernel_13A4DEB0(file_addr, 0x4) and makes several sceIoIoctl calls.
It also verifies the edat file in a similar way as it is done with sprx. The main key decryption is processed with a call to sceNpDrmGetVersionKey. This key is later sent with another sceIoIoctl command.


sceIoIoctl commands:
Code:
// These commands are sent by some of the sceNpDrmXXX functions.
sceIoIoctl(fd, 0x41000010, 0, 0, 0, 0);   // Get DRM file size.
sceIoIoctl(fd, 0x41000006, 0, 0, 0, 0) ;  // Init DRM mode.
sceIoIoctl(fd, 0x41000005, in_addr, 0x8, out_addr, 0x90); // Unknown.
sceIoIoctl(fd, 0x41000002, in_addr, 0x4, 0, 0); // Unknown.
sceIoIoctl(fd, 0x41000001, in_addr, 0x10, 0, 0); // Send DRM AES-128bit key.


Keys:
Code:
RIF/ACT keys (sceNpDrmGetVersionKey):
byte[] rif_key = {0xDA, 0x7D, 0x4B, 0x5E, 0x49, 0x9A, 0x4F, 0x53, 0xB1, 0xC1, 0xA1, 0x4A, 0x74, 0x84, 0x44, 0x3B};
byte[] actdat_key = {0x5E, 0x06, 0xE0, 0x4F, 0xD9, 0x4A, 0x71, 0xBF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
byte[] unk_key1 = {0x69, 0xB4, 0x53, 0xF2, 0xE4, 0x21, 0x89, 0x8E, 0x53, 0xE4, 0xA3, 0x5A, 0x5B, 0x91, 0x79, 0x51};
byte[] unk_key2 = {0xF0, 0x79, 0xD5, 0x19, 0x2D, 0x5D, 0xD3, 0x8C, 0xB5, 0x4B, 0x9E, 0xCD, 0xCD, 0xFD, 0xD3, 0xD7};

Free license key (sceNpDrmGetFixedKey):
byte[] fixed_key = {0x38, 0x20, 0xD0, 0x11, 0x07, 0xA3, 0xFF, 0x3E, 0x0A, 0x4C, 0x20, 0x85, 0x39, 0x10, 0xB5, 0x54};

EDAT/SPRX internal key (sceNpDrmGetModuleKey/sceNpDrmEdataSetupKey):
byte[] module_key = {0xBA, 0x87, 0xE4, 0xAB, 0x2C, 0x60, 0x5F, 0x59, 0xB8, 0x3B, 0xDB, 0xA6, 0x82, 0xFD, 0xAE, 0x14};

Rename hash (sceNpDrmRenameCheck):
byte[] rename_key = {0xEB, 0x71, 0x5D, 0xB8, 0xD3, 0x73, 0xCE, 0xA4, 0x6F, 0xE7, 0x1D, 0xCF, 0xFF, 0x63, 0xFA, 0xEA};


Signatures:
Code:
ACT.DAT/.RIF Signature:
byte[] act_rif_sig = {0x62, 0x27, 0xB0, 0x0A, 0x02, 0x85, 0x6F, 0xB0, 0x41, 0x08, 0x87, 0x67, 0x19, 0xE0, 0xA0, 0x18, 0x32, 0x91, 0xEE, 0xB9, 0x6E, 0x73, 0x6A, 0xBF, 0x81, 0xF7, 0x0E, 0xE9, 0x16, 0x1B, 0x0D, 0xDE, 0xB0, 0x26, 0x76, 0x1A, 0xFF, 0x7B, 0xC8, 0x5B};

EDAT/SPRX Signature:
byte[] edat_sprx_sig = {0x1F, 0x07, 0x2B, 0xCC, 0xC1, 0x62, 0xF2, 0xCF, 0xAE, 0xA0, 0xE7, 0xF4, 0xCD, 0xFD, 0x9C, 0xAE, 0xC6, 0xC4, 0x55, 0x21, 0x53, 0x01, 0xF4, 0xE3, 0x70, 0xC3, 0xED, 0xE2, 0xD4, 0xF5, 0xDB, 0xC3, 0xA7, 0xDE, 0x8C, 0xAA, 0xE8, 0xAD, 0x5B, 0x7D};

---------------------------------------------------------------------------------------

As you can see there's still plenty of work to do, but I think I'm on the right the track, hopefully... Tongue
Of course, all help is welcome. Wink
Reply


Messages In This Thread
DLC Decryption - by Hykem - 09-01-2011, 09:16 PM
RE: DLC Decryption - by shin x - 09-01-2011, 09:56 PM
RE: DLC Decryption - by beanclr - 09-02-2011, 09:32 AM
RE: DLC Decryption - by shin x - 09-02-2011, 09:58 AM
RE: DLC Decryption - by Hykem - 09-02-2011, 04:19 PM
RE: DLC Decryption - by beanclr - 09-02-2011, 11:42 PM
RE: DLC Decryption - by shin x - 09-03-2011, 07:09 PM
RE: DLC Decryption - by beanclr - 09-04-2011, 12:23 AM
RE: DLC Decryption - by Resus - 09-05-2011, 07:12 PM
RE: DLC Decryption - by andutrache - 09-04-2011, 02:15 AM
RE: DLC Decryption - by Hykem - 09-04-2011, 04:34 PM
RE: DLC Decryption - by Shina - 09-05-2011, 12:16 AM
RE: DLC Decryption - by Hykem - 09-05-2011, 03:46 PM
RE: DLC Decryption - by Shina - 09-06-2011, 04:46 AM
RE: DLC Decryption - by Shina - 09-25-2011, 07:49 PM
RE: DLC Decryption - by serio - 09-26-2011, 08:43 AM
RE: DLC Decryption - by bugmenot - 10-20-2011, 05:53 PM
RE: DLC Decryption - by Hykem - 12-22-2011, 07:00 PM
RE: DLC Decryption - by tpu - 02-09-2012, 02:26 PM
RE: DLC Decryption - by Hykem - 02-09-2012, 05:05 PM
RE: DLC Decryption - by tpu - 02-10-2012, 07:47 AM
RE: DLC Decryption - by Hykem - 02-10-2012, 04:31 PM
RE: DLC Decryption - by Krude - 02-10-2012, 11:37 PM
RE: DLC Decryption - by Hykem - 02-11-2012, 03:37 PM
RE: DLC Decryption - by venetiancrusader - 04-26-2012, 07:45 AM
RE: DLC Decryption - by Zekro - 04-26-2012, 04:08 PM
RE: DLC Decryption - by Hykem - 06-22-2012, 11:55 PM
RE: DLC Decryption - by hyakki - 06-23-2012, 12:37 AM
RE: DLC Decryption - by serio - 06-23-2012, 02:12 AM
RE: DLC Decryption - by Hykem - 06-23-2012, 02:24 PM
RE: DLC Decryption - by sipomisery - 07-10-2012, 05:13 PM
RE: DLC Decryption - by serio - 07-10-2012, 07:30 PM
RE: DLC Decryption - by abood555 - 08-24-2012, 11:32 AM
RE: DLC Decryption - by serio - 08-24-2012, 06:17 PM
RE: DLC Decryption - by abood555 - 08-24-2012, 08:40 PM
RE: DLC Decryption - by montcer9012 - 08-24-2012, 09:29 PM
RE: DLC Decryption - by hyakki - 08-24-2012, 09:06 PM
RE: DLC Decryption - by abood555 - 08-25-2012, 08:06 AM
RE: DLC Decryption - by Shina - 11-13-2012, 12:14 AM
RE: DLC Decryption - by Zekro - 11-13-2012, 01:41 PM
RE: DLC Decryption - by Hykem - 04-12-2013, 11:03 PM
RE: DLC Decryption - by serio - 04-12-2013, 11:58 PM
RE: DLC Decryption - by Hykem - 04-13-2013, 01:25 AM
RE: DLC Decryption - by nash67 - 04-13-2013, 12:04 AM
RE: DLC Decryption - by montcer9012 - 04-13-2013, 12:29 AM
RE: DLC Decryption - by serio - 04-13-2013, 01:19 AM
RE: DLC Decryption - by serio - 04-13-2013, 02:19 AM
RE: DLC Decryption - by hyakki - 04-13-2013, 05:10 AM
RE: DLC Decryption - by sum2012 - 04-13-2013, 06:01 AM
RE: DLC Decryption - by onelight - 04-13-2013, 06:24 AM
RE: DLC Decryption - by Herrod22 - 04-13-2013, 12:15 PM
RE: DLC Decryption - by nash67 - 04-13-2013, 12:22 PM
RE: DLC Decryption - by Hykem - 04-13-2013, 01:26 PM
RE: DLC Decryption - by chokaz - 04-13-2013, 02:23 PM
RE: DLC Decryption - by serio - 04-13-2013, 03:05 PM
RE: DLC Decryption - by chokaz - 04-13-2013, 04:34 PM
RE: DLC Decryption - by Sarisa81 - 04-13-2013, 10:20 PM
RE: DLC Decryption - by Hykem - 04-13-2013, 11:53 PM
RE: DLC Decryption - by montcer9012 - 04-13-2013, 11:55 PM
RE: DLC Decryption - by Hykem - 04-14-2013, 12:00 AM
RE: DLC Decryption - by montcer9012 - 04-14-2013, 12:02 AM
RE: DLC Decryption - by serio - 04-14-2013, 12:58 AM
RE: DLC Decryption - by nash67 - 04-14-2013, 01:35 AM
RE: DLC Decryption - by Sarisa81 - 04-14-2013, 02:34 AM
RE: DLC Decryption - by sum2012 - 04-14-2013, 04:51 AM
RE: DLC Decryption - by Herrod22 - 04-14-2013, 11:45 AM
RE: DLC Decryption - by hyakki - 04-14-2013, 06:22 AM
RE: DLC Decryption - by sum2012 - 04-14-2013, 08:53 AM
RE: DLC Decryption - by Hykem - 04-14-2013, 07:55 PM
RE: DLC Decryption - by serio - 04-14-2013, 08:28 PM
RE: DLC Decryption - by sum2012 - 04-14-2013, 10:23 PM
RE: DLC Decryption - by BlackDaemon - 04-15-2013, 08:01 AM
RE: DLC Decryption - by serio - 04-16-2013, 11:49 PM
RE: DLC Decryption - by Hykem - 04-17-2013, 03:25 PM
RE: DLC Decryption - by serio - 04-17-2013, 05:50 PM
RE: DLC Decryption - by pumloveju - 04-24-2013, 05:41 AM
RE: DLC Decryption - by nash67 - 04-26-2013, 07:38 AM
RE: DLC Decryption - by takaten - 05-21-2013, 02:32 AM
RE: DLC Decryption - by Gerion - 06-08-2013, 12:16 PM
RE: DLC Decryption - by Zekro - 06-08-2013, 12:44 PM
RE: DLC Decryption - by Gerion - 06-08-2013, 12:52 PM
RE: DLC Decryption - by laughin man - 07-07-2013, 06:58 PM
RE: DLC Decryption - by DragonNeos - 07-07-2013, 08:15 PM
RE: DLC Decryption - by laughin man - 07-07-2013, 10:45 PM
RE: DLC Decryption - by Zekro - 07-08-2013, 11:46 AM
RE: DLC Decryption - by laughin man - 07-08-2013, 12:07 PM
RE: DLC Decryption - by DragonNeos - 07-09-2013, 06:44 PM
RE: DLC Decryption - by onelight - 09-28-2013, 01:23 AM
RE: DLC Decryption - by onelight - 10-05-2013, 06:12 AM
RE: DLC Decryption - by Hykem - 10-10-2013, 10:55 PM
RE: DLC Decryption - by onelight - 10-12-2013, 12:19 AM
RE: DLC Decryption - by Hykem - 10-21-2013, 06:41 PM
RE: DLC Decryption - by onelight - 10-22-2013, 09:12 AM
RE: DLC Decryption - by Hykem - 10-24-2013, 07:36 PM
RE: DLC Decryption - by onelight - 10-26-2013, 01:23 AM
RE: DLC Decryption - by Hykem - 10-27-2013, 03:11 PM
RE: DLC Decryption - by onelight - 10-28-2013, 05:53 AM
RE: DLC Decryption - by Hykem - 11-23-2013, 11:44 PM
RE: DLC Decryption - by onelight - 11-24-2013, 02:02 PM
RE: DLC Decryption - by Hykem - 11-26-2013, 12:42 AM
RE: DLC Decryption - by onelight - 01-03-2014, 03:37 AM
RE: DLC Decryption - by Hykem - 01-08-2014, 05:56 PM
RE: DLC Decryption - by onelight - 01-09-2014, 11:39 AM
RE: DLC Decryption - by Hykem - 01-09-2014, 09:45 PM
RE: DLC Decryption - by onelight - 01-10-2014, 12:41 PM
RE: DLC Decryption - by Hykem - 01-10-2014, 03:20 PM
RE: DLC Decryption - by onelight - 01-11-2014, 04:27 AM
RE: DLC Decryption - by Hykem - 01-11-2014, 03:58 PM
RE: DLC Decryption - by Hykem - 01-15-2014, 07:50 PM
RE: DLC Decryption - by onelight - 03-28-2014, 05:08 AM
RE: DLC Decryption - by nightflyer - 04-07-2014, 01:24 PM
RE: DLC Decryption - by Hykem - 04-11-2014, 06:25 PM
RE: DLC Decryption - by nightflyer - 04-15-2014, 10:29 AM
RE: DLC Decryption - by Hykem - 04-16-2014, 09:59 PM
RE: DLC Decryption - by nightflyer - 04-17-2014, 07:40 AM
RE: DLC Decryption - by Hykem - 04-18-2014, 02:34 PM
RE: DLC Decryption - by Vegerunks - 06-15-2014, 04:18 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)