Editing Keystone
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
This file is generated on app package generation based on the passcode provided. It is then included in every | This file is generated on app package generation based on the passcode provided. It is then included in every savegame created by the app. | ||
It is used to prevent apps from mounting savedata of other apps, as you need to know at least the fingerprint to do it. | |||
== Passcode == | |||
The passcode is a 32 character string used on package generation to create the keystone file. | |||
The keystone file | |||
== Structure == | == Structure == | ||
Size is always 96 bytes. | Size is always 96 (0x60) bytes for PS4 (and 64 (0x40) bytes for PSVita). | ||
{| class="wikitable" | {| class="wikitable" | ||
! Offset !! Size !! Description !! | ! Offset !! Size !! Description !! Example | ||
|- | |- | ||
| 0x0 || | | 0x0 || 0x20 || MAGIC ("keystone") and some constant bytes || 6b 65 79 73 74 6f 6e 65 02 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | ||
|- | |- | ||
| | | 0x20 || 0x20 || HMAC-SHA256 (32 bytes) of the bytes of the passcode using keystone_passcode_secret as key || | ||
|- | |- | ||
| | | 0x40 || 0x20 || HMAC-SHA256 (32 bytes) of the previous two sections using keystone_ks_secret as key || | ||
| | |||
|} | |} | ||
== | == Sample keystone file generation == | ||
'''CSharp''' | |||
keystone = | |||
<source lang="csharp"> | <source lang="csharp"> | ||
public static byte [] GenerateKeystoneFile (string passcode) | public static byte [] GenerateKeystoneFile (string passcode) | ||
Line 102: | Line 49: | ||
// 6. Concat the constant bytes from point 1, the fingerprint from point 3 and the hmac from point 5 | // 6. Concat the constant bytes from point 1, the fingerprint from point 3 and the hmac from point 5 | ||
keystone = keystone.Concat(sha256hmac).ToArray(); | keystone = keystone.Concat(sha256hmac).ToArray(); | ||
return keystone; | return keystone; | ||
} | } | ||
</source> | </source> | ||
== | == Sample keystone file == | ||
Sample keystone file created when provided a passcode consisting of all zeros "00000000000000000000000000000000": | |||
<pre> | <pre> | ||
The first 32 are constant: | The first 32 are constant: | ||
Line 127: | Line 70: | ||
00000050 b7 32 14 3b 91 cd 2e 4f ea 2d 20 53 10 6e b7 5d |.2.;...O.- S.n.]| | 00000050 b7 32 14 3b 91 cd 2e 4f ea 2d 20 53 10 6e b7 5d |.2.;...O.- S.n.]| | ||
</pre> | </pre> | ||