Skip to content

Commit

Permalink
Adjust readme, add example of ps2keys layout
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK committed Dec 19, 2024
1 parent f39ed36 commit f1e81d6
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 6 deletions.
126 changes: 126 additions & 0 deletions PS2KEYS.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
[default]
MG_CARDKEY_0=...
MG_CARDIV_0=...
MG_CARDKEY2_0=...
MG_CARDIV2_0=...
MG_CARDKEY_1=...
MG_CARDIV_1=...
MG_CARDKEY2_1=...
MG_CARDIV2_1=...
MG_CARDKEY_2=...
MG_CARDIV_2=...
MG_CARDKEY2_2=...
MG_CARDIV2_2=...
MG_KBIT_MASTER_KEY=...
MG_KC_MASTER_KEY=...
MG_KBIT_IV=...
MG_KC_IV=...
MG_SIG_MASTER_KEY=...
MG_SIG_HASH_KEY=...
MG_ROOTSIG_HASH_KEY=...
MG_ROOTSIG_MASTER_KEY=...
MG_CONTENT_IV=...
MG_CONTENT_TABLE_IV=...
MG_CHALLENGE_IV=...

[retail]
MG_CARDKEY_0=...
MG_CARDIV_0=...
MG_CARDKEY2_0=...
MG_CARDIV2_0=...
MG_CARDKEY_1=...
MG_CARDIV_1=...
MG_CARDKEY2_1=...
MG_CARDIV2_1=...
MG_CARDKEY_2=...
MG_CARDIV_2=...
MG_CARDKEY2_2=...
MG_CARDIV2_2=...
MG_KBIT_MASTER_KEY=...
MG_KC_MASTER_KEY=...
MG_KBIT_IV=...
MG_KC_IV=...
MG_SIG_MASTER_KEY=...
MG_SIG_HASH_KEY=...
MG_ROOTSIG_HASH_KEY=...
MG_ROOTSIG_MASTER_KEY=...
MG_CONTENT_IV=...
MG_CONTENT_TABLE_IV=...
MG_CHALLENGE_IV=...

[arcade]
MG_CARDKEY_0=...
MG_CARDIV_0=...
MG_CARDKEY2_0=...
MG_CARDIV2_0=...
MG_CARDKEY_1=...
MG_CARDIV_1=...
MG_CARDKEY2_1=...
MG_CARDIV2_1=...
MG_CARDKEY_2=...
MG_CARDIV_2=...
MG_CARDKEY2_2=...
MG_CARDIV2_2=...
MG_KBIT_MASTER_KEY=...
MG_KC_MASTER_KEY=...
MG_KBIT_IV=...
MG_KC_IV=...
MG_SIG_MASTER_KEY=...
MG_SIG_HASH_KEY=...
MG_ROOTSIG_HASH_KEY=...
MG_ROOTSIG_MASTER_KEY=...
MG_CONTENT_IV=...
MG_CONTENT_TABLE_IV=...
MG_CHALLENGE_IV=...
OVERRIDE_KBIT=...
OVERRIDE_KC=...

[dev]
MG_CARDKEY_0=...
MG_CARDIV_0=...
MG_CARDKEY2_0=...
MG_CARDIV2_0=...
MG_CARDKEY_1=...
MG_CARDIV_1=...
MG_CARDKEY2_1=...
MG_CARDIV2_1=...
MG_CARDKEY_2=...
MG_CARDIV_2=...
MG_CARDKEY2_2=...
MG_CARDIV2_2=...
MG_KBIT_MASTER_KEY=...
MG_KC_MASTER_KEY=...
MG_KBIT_IV=...
MG_KC_IV=...
MG_SIG_MASTER_KEY=...
MG_SIG_HASH_KEY=...
MG_ROOTSIG_HASH_KEY=...
MG_ROOTSIG_MASTER_KEY=...
MG_CONTENT_IV=...
MG_CONTENT_TABLE_IV=...
MG_CHALLENGE_IV=...

[prototype]
MG_CARDKEY_0=...
MG_CARDIV_0=...
MG_CARDKEY2_0=...
MG_CARDIV2_0=...
MG_CARDKEY_1=...
MG_CARDIV_1=...
MG_CARDKEY2_1=...
MG_CARDIV2_1=...
MG_CARDKEY_2=...
MG_CARDIV_2=...
MG_CARDKEY2_2=...
MG_CARDIV2_2=...
MG_KBIT_MASTER_KEY=...
MG_KC_MASTER_KEY=...
MG_KBIT_IV=...
MG_KC_IV=...
MG_SIG_MASTER_KEY=...
MG_SIG_HASH_KEY=...
MG_ROOTSIG_HASH_KEY=...
MG_ROOTSIG_MASTER_KEY=...
MG_CONTENT_IV=...
MG_CONTENT_TABLE_IV=...
MG_CHALLENGE_IV=...
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,32 @@ Place them in your home directory (%USERPROFILE%) in the "PS2KEYS.dat" file as a

## Usage

decrypt - decrypt and check the signature of kelf files
%s <main command> <headerid> <input> <output> [Flags]
decrypt - decrypt and check the signature of kelf files
encrypt <headerid> - encrypt and sign kelf files <headerid>: fmcb, fhdb, mbr
fmcb - for retail PS2 memory cards
dnasload - for retail PS2 memory cards (PSX Whitelist)
fhdb - for retail PS2 HDD (HDD OSD / BB Navigator)
dongle - for namco System 246/256 and Konami Python 1
mbr - for retail PS2 HDD (mbr injection).
Note: for mbr, elf should load from 0x100000 and should be without headers:
readelf -h <input_elf> should show 0x100000 or 0x100008
Flags:
--keys Specify keys to be used from PS2KEYS.dat (default, retail, dev, arcade, prototype)
--mgzone Specify custom region whitelist (default 0xFF: all allowed), example: --mgzone=0x03 (Japan+North America)
--apptype Specify application type (default 1: XOSDMAIN), example --apptype=7
--kflags Specify custom flags for KELF Header, default: --kflags=KELF
--systemtype Specify sys type (PS2 or PSX)


headerless elf creation:

$(EE_OBJCOPY) -O binary -v <input_elf> <headerless_elf>
examples:

kelftool encrypt fhdb input.elf output.kelf
kelftool decrypt input.kelf output.elf
kelftool encrypt dongle boot.elf boot.bin --keys=arcade --apptype=7

*decrypt* command will also print useful information about kelf

Expand Down
10 changes: 5 additions & 5 deletions src/kelftool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ int encrypt(int argc, char **argv)

if (argc < 4) {
printf("%s encrypt <headerid> <input> <output> [Flags]\n", argv[0]);
printf("<headerid>: fmcb, fhdb, mbr dnasload dongle\n");
printf("<headerid>: fmcb, fhdb, mbr, dnasload, dongle\n");
printf("\tFlags:\n");
printf("\t\t--keys Specify keys to be used\n");
printf("\t\t--mgzone Specify custom region whitelist\n");
printf("\t\t--apptype Specify application type \n");
printf("\t\t--kflags Specify custom flags for KELF Header\n");
printf("\t\t--keys Specify keys to be used from PS2KEYS.dat (default, retail, dev, arcade, prototype)\n");
printf("\t\t--mgzone Specify custom region whitelist (default 0xFF: all allowed), example: --mgzone=0x03 (Japan+North America)\n");
printf("\t\t--apptype Specify application type (default 1: XOSDMAIN), example --apptype=7\n");
printf("\t\t--kflags Specify custom flags for KELF Header, default: --kflags=KELF\n");
printf("\t\t--systemtype Specify sys type (PS2 or PSX)\n");
return -1;
}
Expand Down

0 comments on commit f1e81d6

Please sign in to comment.