|
|
#111 | |
|
Apprentice
![]() Join Date: Oct 2011
Posts: 14
Likes: 1
Liked 2 Times in 2 Posts
Mentioned: 22 Post(s)
Tagged: 0 Thread(s)
|
For example in your file metadata for first block is at 0x100-0x120, then 0x120-0x4120 is first block of data, then again metadata for second block (0x4120-0x4140), then second block of data (0x4140-0x8140)... But the problem of 0x3c is in obfuscation of data hash in metadata section. In debug files in first 16 bytes is hash and then 16 nulled bytes. |
|
|
|
|
|
|
#113 |
|
Homebrew Developer
![]() Join Date: Oct 2011
Posts: 20
Likes: 11
Liked 367 Times in 19 Posts
Mentioned: 68 Post(s)
Tagged: 0 Thread(s)
|
First new version for 0x3C:
http://pastebin.com/TtuNF5J5 @EXE.trim.ALL You are calculating properly the hash. However you probably are not considering FLAG0x10. This flags indicates that the algorithm for hash is HMAC instead of CMAC. If FLAG0x20 is set the hash len is 0x14, otherwise the hash is truncated to 0x10 bytes. Also another effect of FLAG0x10 is that the hashkey != encryptionKey. When this byte is set the hashKey has to be reencrypted again to calculate the proper value. Check the code above BTW I confirm that for files with flag0x20 the structure changes from all metadatasection + all data to metadatasection and data interleaved. That means that the metadatasectionhash is ignored. I also confirm your isEncrypted. (credits to @EXE.trim.ALL ) |
|
|
|
|
|
#115 | |
|
Apprentice
Join Date: Dec 2011
Posts: 3
Likes: 0
Liked 2 Times in 1 Post
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
|
So there must be an other way for the PS3 to obtain the devklic key. As you said, it is used to create a pkg. The algorithm for debug pkg files has already been reverse engineered, and the devklic is stored in obfuscated form at offset 0x70. For retail files, this might be similar. The algorithm for debug files does not work on retail ones. The algorithm might be a more serious cipher with a "secret" key. |
|
|
|
|
|
|
#116 | |
|
Apprentice
![]() Join Date: Oct 2011
Posts: 14
Likes: 1
Liked 2 Times in 2 Posts
Mentioned: 22 Post(s)
Tagged: 0 Thread(s)
|
|
|
|
|
|
|
|
#118 | |
|
Member
![]() Join Date: Oct 2011
Posts: 83
Likes: 31
Liked 50 Times in 9 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
|
Yeah I remembered
|
|
|
|
|
|
|
#119 |
|
Member
![]() Join Date: Oct 2011
Posts: 83
Likes: 31
Liked 50 Times in 9 Posts
Mentioned: 15 Post(s)
Tagged: 0 Thread(s)
|
Problem solved, just use devklic.
|
|
|
|
|
|
#120 |
|
Apprentice
Join Date: Dec 2011
Posts: 3
Likes: 0
Liked 2 Times in 1 Post
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
|
I dont know if it is useful, but for the sake of completeness, I have reversed the hash algorithms for debug NPD headers. Interestingly, the devklic can be retreived from debug files which are not type=1 (most EDATs are not type=1, only USRDIR/EBOOT.BIN are type=1).
Pseudocode: Code:
function byte[] nameHash(byte[] digest) {
byte[] nameHash=new byte[16];
for (int i = 0; i < 16; i++)
nameHash[i] = digest[i] ^ 0xFF;
return nameHash;
}
Code:
function byte[] headerHash(byte[] digest, int type, byte[] devklic){
byte[] headerHash;
if (type == 1){
headerHash={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
}else{
headerHash=devklic;
}
for (int i = 0; i < 16; i++)
headerHash[i] = headerHash[i] ^ digest[i] ^ 0x55;
return headerHash;
}
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|