PS3 Looking for info on pkg files

Discussion in 'Homebrew Development' started by pink1, Jun 13, 2018 at 6:55 PM.

  1. 700
    849
    103
    pink1

    pink1 Moderator Developer

    Joined:
    Feb 25, 2015
    Messages:
    700
    Likes Received:
    849
    Trophy Points:
    103
    Gender:
    Male
    I've been wanting to make a pkg tool for a while to use in other projects and have about everything I need. I can decrypt, extract, repack and encrypt a pkg file using the original header. What I'm having trouble with is making a header for a new pkg I don't understand how to get bytes 0x60 - 0x80. I've been trying to read the wiki and python code but I'm not getting very far at it.
    If anyone can point me to something to study up on or explain it to me I'd be really grateful.
     
  2. 1,753
    1,615
    123
    sandungas

    sandungas Moderator Developer

    Joined:
    Dec 31, 2014
    Messages:
    1,753
    Likes Received:
    1,615
    Trophy Points:
    123
    pink1 likes this.
  3. 6,963
    5,500
    123
    bguerville

    bguerville Moderator Developer

    Joined:
    Feb 25, 2015
    Messages:
    6,963
    Likes Received:
    5,500
    Trophy Points:
    123
    Location:
    Earth
    pink1 likes this.
  4. 113
    78
    38
    catalinnc

    catalinnc Member

    Joined:
    Dec 26, 2015
    Messages:
    113
    Likes Received:
    78
    Trophy Points:
    38
    for retail pkgs is very clear...see here:
    http://www.psdevwiki.com/ps3/PKG_files
    Code:
    digest 0x60 0x10 09 8B A2 CA 2D 30 30 1F 8B 5B 82 79 C6 70 35 F3 sha1 from debug files and attributes together merged in one block
    pkg_data_riv 0x70 0x10 D5 FA 15 9E 7F AC 82 70 BB 3E 0C EB 97 3D 30 11 aes-128-ctr iv. Used with gpkg_key to decrypt data.
    header_cmac_hash 0x80 0x10 48 0D 86 60 9F 26 8E 7F 4F B4 DA A4 33 1E 9A A1 CMAC OMAC hash from 0x00-0x7F. PS3 gpkg_key used as key.
    you dont really need to calculate the digest at all (use a random number)...
    _

    p.s. for debug pkgs i can't help at all...
    _
     
  5. 700
    849
    103
    pink1

    pink1 Moderator Developer

    Joined:
    Feb 25, 2015
    Messages:
    700
    Likes Received:
    849
    Trophy Points:
    103
    Gender:
    Male
    Thanks. I've been trying to study the wiki and the digest is the part I was really having problems trying to understand. I'm trying to do debug pkgs but if I can get it working I may try to add HAN signing just because it would be nice to have the code ready to make and sign a pkg for HAN with.

    Debug pkgs use the digest as the key to encrypt so if we can just use a random number that will be great.

    PS. It's been a long time since we've talked hope all is well bud :)
     
  6. 113
    78
    38
    catalinnc

    catalinnc Member

    Joined:
    Dec 26, 2015
    Messages:
    113
    Likes Received:
    78
    Trophy Points:
    38
    more info on debug pkgs...

    on 0x60 is indeed the encryption key (sort of - actually you have to manipulate that value to get the real key) - you can use a random number

    on 0x70 is the iv key (this is obtained from the encryption [email protected] [manipulated in a diff way!] xored with the klic)...

    on 0x80 is some kind of hash that i dont know...
    _
     
    pink1 and bguerville like this.
  7. 113
    78
    38
    catalinnc

    catalinnc Member

    Joined:
    Dec 26, 2015
    Messages:
    113
    Likes Received:
    78
    Trophy Points:
    38
    this hash is a chunk of sha1 of the data before it...
    _
     
    pink1 likes this.
  8. 700
    849
    103
    pink1

    pink1 Moderator Developer

    Joined:
    Feb 25, 2015
    Messages:
    700
    Likes Received:
    849
    Trophy Points:
    103
    Gender:
    Male
    I’ve been studying the python scripts and am getting a better idea of how to port the header code. I have a lot of c# pkg code that I’ve collected over the years for everything other than the header so I don’t need to port much. This is the first time I’ve messed with photon so I was letting it intimidate me more than it should have.

    I’m still very interested in getting as much info on it as I can to get a better understanding and to be able to add comments to the code for reference.
     
  9. 137
    35
    38
    ayassinsayed

    ayassinsayed Member

    Joined:
    Mar 16, 2018
    Messages:
    137
    Likes Received:
    35
    Trophy Points:
    38
    Gender:
    Male
    Where i can get Python script PKG_Creator by CaptainCPS-X ?


    Sent from my iPhone using Tapatalk
     

Share This Page