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:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Savedata Encryption/Decryption
#61
(10-11-2013, 01:43 AM)popsdeco Wrote: Hi hykem;

Sorry to have made you come here, but I'm glad that there are some opportunities to complete stuff.
So, I checked current SAVEDATA.java and I'm sure https://github.com/cielavenir/psp-saveda...ecrypter.c 's encryption is OK, but the hash isn't proper.
# Cleaning up the code will come later.

if inbuf is decrypted save file,
EncryptSavedata(inbuf, size, key);
fwrite(inbuf,1,size+0x10,stdout);
UpdateSavedataHashes(param,inbuf,size+0x10);
is OK?

You say "You need to add PSF file parsing", but I'm already able to search for SAVEFILE_PARAMS.
Since this is mostly for searching savedata exploit, passing param to UpdateSavedataHashes() is mandatory here. So I suppose this is enough, but... calculated hash for already-encrypted-bin isn't the same as the one in PARAM.SFO...

Hi popsdeco!
What I mean with PSF file parsing is that you also need to search for SAVEDATA_FILE_LIST. This is the part of PARAM.SFO that has the SAVEDATA file name and the file key written.
Each time the encryption finishes it returns a hash that needs to be written in the PARAM.SFO.
So, in SAVEDATA_PARAMS you have the mode flags (0x01, 0x21 or 0x41) and 3 hashes (one at 0x10, another at 0x20 and another at 0x70). Then, in SAVEDATA_FILE_LIST you have the save file name (ULUSXXXXX for example) and the encryption key right after it (offset 0x0D). This key is replaced by the SAVEDATA encryption hash and is later checked by the PSP.

In JPCSP this is happening in SceUtilitySavedataParam (https://code.google.com/p/jpcsp/source/b...Param.java ) in the function writePsf.

The process in JPCSP is:
-> Encrypt the data (EncryptSavedata());
-> Save the hash generated by the encryption (hleSdGetLastIndex(ctx1, hash, key) in EncryptSavedata());
-> Write the encrypted file (in SceUtilitySavedataParam.writeEncryptedFile());
-> Use the encrypted file for hash generation (in UpdateSavedataHashes());
-> Apply the hash generation algorithm and write 3 new hashes at 0x10, 0x20 and 0x70 of the PARAM.SFO SAVEDATA_PARAMS structure (in UpdateSavedataHashes());
-> Write the saved hash in SAVEDATA_FILE_LIST right after the SAVEDATA file name (in SceUtilitySavedataParam.writePsf()).

The hashes will always be different every time you re-encrypt the data (different saves in the same game always have different hashes), but they should be all related to the SAVEDATA binary file.
Your tool is already doing everything right, all that's left is that hash generated after the save file name in PARAM.SFO.
Reply


Messages In This Thread
Savedata Encryption/Decryption - by Hykem - 02-16-2011, 05:52 PM
RE: Savedata Encryption/Decryption - by rbgbenny5 - 07-30-2011, 04:32 AM
RE: Savedata Encryption/Decryption - by skyeyes83 - 02-17-2011, 10:17 AM
RE: Savedata Encryption/Decryption - by Hykem - 02-17-2011, 08:11 PM
RE: Savedata Encryption/Decryption - by oliox - 02-17-2011, 10:39 PM
RE: Savedata Encryption/Decryption - by Kai3213 - 02-17-2011, 11:05 PM
RE: Savedata Encryption/Decryption - by Hykem - 02-18-2011, 04:40 PM
RE: Savedata Encryption/Decryption - by Hykem - 02-18-2011, 05:42 PM
RE: Savedata Encryption/Decryption - by Kai3213 - 02-19-2011, 03:00 PM
RE: Savedata Encryption/Decryption - by Hykem - 02-19-2011, 04:31 PM
RE: Savedata Encryption/Decryption - by Zekro - 02-20-2011, 10:24 AM
RE: Savedata Encryption/Decryption - by oliox - 02-20-2011, 08:34 PM
RE: Savedata Encryption/Decryption - by Kai3213 - 02-20-2011, 09:03 PM
RE: Savedata Encryption/Decryption - by oliox - 02-20-2011, 09:25 PM
RE: Savedata Encryption/Decryption - by Kai3213 - 03-15-2011, 12:59 AM
RE: Savedata Encryption/Decryption - by Kai3213 - 03-15-2011, 01:31 AM
RE: Savedata Encryption/Decryption - by beanclr - 03-15-2011, 01:48 AM
RE: Savedata Encryption/Decryption - by beanclr - 03-15-2011, 04:04 AM
RE: Savedata Encryption/Decryption - by beanclr - 03-15-2011, 10:06 PM
RE: Savedata Encryption/Decryption - by beanclr - 03-15-2011, 10:58 PM
RE: Savedata Encryption/Decryption - by Darth1701 - 03-16-2011, 07:24 AM
RE: Savedata Encryption/Decryption - by oliox - 03-16-2011, 02:00 PM
RE: Savedata Encryption/Decryption - by Darth1701 - 03-16-2011, 02:13 PM
RE: Savedata Encryption/Decryption - by Malicii - 05-27-2011, 07:10 AM
RE: Savedata Encryption/Decryption - by Hykem - 11-14-2011, 10:38 PM
RE: Savedata Encryption/Decryption - by Itaru - 11-15-2011, 01:16 PM
RE: Savedata Encryption/Decryption - by Hykem - 11-15-2011, 08:00 PM
RE: Savedata Encryption/Decryption - by AthenaADP - 11-17-2011, 07:48 AM
RE: Savedata Encryption/Decryption - by Itaru - 11-17-2011, 02:02 PM
RE: Savedata Encryption/Decryption - by Hykem - 11-23-2011, 06:04 AM
RE: Savedata Encryption/Decryption - by serio - 11-27-2011, 05:37 AM
RE: Savedata Encryption/Decryption - by serio - 12-26-2011, 11:41 AM
RE: Savedata Encryption/Decryption - by Hykem - 12-26-2011, 03:26 PM
RE: Savedata Encryption/Decryption - by popsdeco - 01-04-2012, 11:46 AM
RE: Savedata Encryption/Decryption - by Hykem - 01-04-2012, 03:37 PM
RE: Savedata Encryption/Decryption - by AthenaADP - 01-05-2012, 03:54 AM
RE: Savedata Encryption/Decryption - by Hykem - 01-05-2012, 03:04 PM
RE: Savedata Encryption/Decryption - by serio - 04-08-2012, 06:55 PM
RE: Savedata Encryption/Decryption - by popsdeco - 06-13-2012, 01:30 AM
RE: Savedata Encryption/Decryption - by Zekro - 06-13-2012, 12:16 PM
RE: Savedata Encryption/Decryption - by serio - 06-13-2012, 12:40 PM
RE: Savedata Encryption/Decryption - by popsdeco - 06-13-2012, 02:54 PM
RE: Savedata Encryption/Decryption - by serio - 07-03-2012, 03:01 AM
RE: Savedata Encryption/Decryption - by popsdeco - 07-06-2012, 04:12 AM
RE: Savedata Encryption/Decryption - by Hykem - 10-10-2013, 11:04 PM
RE: Savedata Encryption/Decryption - by popsdeco - 10-11-2013, 01:43 AM
RE: Savedata Encryption/Decryption - by Hykem - 10-12-2013, 07:53 PM
RE: Savedata Encryption/Decryption - by popsdeco - 10-13-2013, 06:56 AM
RE: Savedata Encryption/Decryption - by Hykem - 10-13-2013, 03:58 PM
RE: Savedata Encryption/Decryption - by popsdeco - 10-14-2013, 07:02 AM
RE: Savedata Encryption/Decryption - by Itaru - 10-14-2013, 04:09 PM
RE: Savedata Encryption/Decryption - by Hykem - 10-21-2013, 06:39 PM
RE: Savedata Encryption/Decryption - by popsdeco - 10-22-2013, 10:32 AM
RE: Savedata Encryption/Decryption - by Hykem - 10-24-2013, 07:49 PM
RE: Savedata Encryption/Decryption - by popsdeco - 10-22-2013, 12:38 PM
RE: Savedata Encryption/Decryption - by Hykem - 10-27-2013, 07:43 PM
RE: Savedata Encryption/Decryption - by popsdeco - 10-28-2013, 08:48 AM
RE: Savedata Encryption/Decryption - by Hykem - 10-28-2013, 08:37 PM
RE: Savedata Encryption/Decryption - by popsdeco - 11-02-2013, 07:04 PM
RE: Savedata Encryption/Decryption - by Hykem - 11-04-2013, 08:53 PM
RE: Savedata Encryption/Decryption - by serio - 11-05-2013, 05:19 PM
RE: Savedata Encryption/Decryption - by popsdeco - 11-10-2013, 06:10 PM
RE: Savedata Encryption/Decryption - by Hykem - 11-11-2013, 05:34 AM
RE: Savedata Encryption/Decryption - by onelight - 11-16-2013, 01:39 AM
RE: Savedata Encryption/Decryption - by Hykem - 11-23-2013, 11:41 PM
RE: Savedata Encryption/Decryption - by onelight - 11-24-2013, 02:46 PM
RE: Savedata Encryption/Decryption - by popsdeco - 11-25-2013, 06:58 PM
RE: Savedata Encryption/Decryption - by popsdeco - 11-29-2013, 01:44 PM
RE: Savedata Encryption/Decryption - by onelight - 01-11-2014, 08:49 AM
RE: Savedata Encryption/Decryption - by Hykem - 01-13-2014, 07:48 PM
RE: Savedata Encryption/Decryption - by onelight - 01-14-2014, 05:49 AM
RE: Savedata Encryption/Decryption - by Hykem - 01-14-2014, 03:29 PM
RE: Savedata Encryption/Decryption - by akaya - 01-14-2014, 06:53 PM
RE: Savedata Encryption/Decryption - by akaya - 01-14-2014, 12:31 AM
RE: Savedata Encryption/Decryption - by Hykem - 01-15-2014, 07:41 PM
RE: Savedata Encryption/Decryption - by akaya - 01-15-2014, 08:50 PM
RE: Savedata Encryption/Decryption - by Hykem - 01-16-2014, 03:06 PM
RE: Savedata Encryption/Decryption - by popsdeco - 01-17-2014, 11:33 AM
RE: Savedata Encryption/Decryption - by Hykem - 01-17-2014, 03:45 PM
RE: Savedata Encryption/Decryption - by popsdeco - 01-18-2014, 04:30 PM
RE: Savedata Encryption/Decryption - by popsdeco - 01-16-2014, 09:35 AM
RE: Savedata Encryption/Decryption - by akaya - 01-17-2014, 01:50 AM
RE: Savedata Encryption/Decryption - by thelight - 01-17-2014, 07:08 AM
RE: Savedata Encryption/Decryption - by Hykem - 01-18-2014, 05:54 PM
RE: Savedata Encryption/Decryption - by akaya - 01-18-2014, 06:12 PM
RE: Savedata Encryption/Decryption - by onelight - 02-09-2014, 06:42 AM
RE: Savedata Encryption/Decryption - by sum2012 - 02-09-2014, 12:57 PM
RE: Savedata Encryption/Decryption - by popsdeco - 02-10-2014, 12:23 PM
RE: Savedata Encryption/Decryption - by popsdeco - 02-11-2014, 08:49 AM
RE: Savedata Encryption/Decryption - by onelight - 02-11-2014, 11:48 AM
RE: Savedata Encryption/Decryption - by shadow - 02-11-2014, 10:24 AM
RE: Savedata Encryption/Decryption - by popsdeco - 02-11-2014, 10:54 AM
RE: Savedata Encryption/Decryption - by shadow - 02-11-2014, 11:14 AM
RE: Savedata Encryption/Decryption - by popsdeco - 02-11-2014, 12:13 PM
RE: Savedata Encryption/Decryption - by popsdeco - 02-12-2014, 07:27 AM
RE: Savedata Encryption/Decryption - by popsdeco - 02-13-2014, 04:46 AM
RE: Savedata Encryption/Decryption - by Hykem - 02-14-2014, 07:49 PM
RE: Savedata Encryption/Decryption - by popsdeco - 02-17-2014, 11:17 AM
RE: Savedata Encryption/Decryption - by Hykem - 03-04-2014, 09:18 PM
RE: Savedata Encryption/Decryption - by popsdeco - 04-13-2014, 04:30 AM
RE: Savedata Encryption/Decryption - by Hykem - 04-13-2014, 01:59 PM
RE: Savedata Encryption/Decryption - by popsdeco - 04-14-2014, 08:57 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)