Skip to content

Commit

Permalink
Make the BOSS keys optional
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewL246 committed Dec 29, 2023
1 parent e1328b7 commit 35c9f4c
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 35 deletions.
23 changes: 23 additions & 0 deletions patches/BOSS/make-boss-keys-optional.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git i/src/config-manager.ts w/src/config-manager.ts
index b027e54..fa5284e 100644
--- i/src/config-manager.ts
+++ w/src/config-manager.ts
@@ -83,15 +83,15 @@ if (!config.http.port) {
}

if (md5(config.crypto.wup.aes_key) !== BOSS_WIIU_AES_KEY_MD5_HASH) {
- errors.push('Invalid BOSS WiiU AES key. Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY environment variable');
+ warnings.push('Invalid BOSS WiiU AES key. Uploading and encrypting files won\'t work! Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY environment variable');
}

if (md5(config.crypto.wup.hmac_key) !== BOSS_WIIU_HMAC_KEY_MD5_HASH) {
- errors.push('Invalid BOSS WiiU HMAC key. Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY environment variable');
+ warnings.push('Invalid BOSS WiiU HMAC key. Uploading and encrypting files won\'t work! Set or correct the PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY environment variable');
}

if (md5(config.crypto.ctr.aes_key) !== BOSS_3DS_AES_KEY_MD5_HASH) {
- errors.push('Invalid BOSS 3DS AES key. Set or correct the PN_BOSS_CONFIG_BOSS_3DS_AES_KEY environment variable');
+ warnings.push('Invalid BOSS 3DS AES key. Set or correct the PN_BOSS_CONFIG_BOSS_3DS_AES_KEY environment variable');
}

if (!config.grpc.boss.address) {
71 changes: 36 additions & 35 deletions scripts/get-boss-keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,47 +15,48 @@ git_base=$(git rev-parse --show-toplevel)
. "$git_base/scripts/.function-lib.sh"
cd "$git_base/console-files"

if ! ls ./boss_keys.bin 1>/dev/null 2>&1; then
error "console-files/boss_keys.bin (Wii U) not found! Please read the README for instructions on dumping your BOSS keys."
exit 1
fi
if ! ls ./aes_keys.txt 1>/dev/null 2>&1; then
error "console-files/aes_keys.txt (3DS) not found! Please read the README for instructions on dumping your BOSS keys."
exit 1
fi

wiiu_aes_key=$(head -c 16 <./boss_keys.bin)
wiiu_hmac_key=$(tail -c +33 ./boss_keys.bin | head -c 64)
wiiu_aes_key_hash=$(printf "%s" "$wiiu_aes_key" | md5sum | cut -d ' ' -f 1)
wiiu_hmac_key_hash=$(printf "%s" "$wiiu_hmac_key" | md5sum | cut -d ' ' -f 1)

if [ "$wiiu_aes_key_hash" = "$expected_wiiu_aes_key_hash" ]; then
success "Found valid Wii U BOSS AES key."
if [ "$check_only" = false ]; then
echo "PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY=$wiiu_aes_key" >>"$git_base/environment/boss.local.env"
if ls ./boss_keys.bin 1>/dev/null 2>&1; then
wiiu_aes_key=$(head -c 16 <./boss_keys.bin)
wiiu_hmac_key=$(tail -c +33 ./boss_keys.bin | head -c 64)
wiiu_aes_key_hash=$(printf "%s" "$wiiu_aes_key" | md5sum | cut -d ' ' -f 1)
wiiu_hmac_key_hash=$(printf "%s" "$wiiu_hmac_key" | md5sum | cut -d ' ' -f 1)

if [ "$wiiu_aes_key_hash" = "$expected_wiiu_aes_key_hash" ]; then
success "Found valid Wii U BOSS AES key."
if [ "$check_only" = false ]; then
echo "PN_BOSS_CONFIG_BOSS_WIIU_AES_KEY=$wiiu_aes_key" >>"$git_base/environment/boss.local.env"
fi
else
error "Wii U BOSS AES key has the wrong hash! Try re-running full_keys_dumper."
fi
else
error "Wii U BOSS AES key has the wrong hash! Try re-running full_keys_dumper."
fi

if [ "$wiiu_hmac_key_hash" = "$expected_wiiu_hmac_key_hash" ]; then
success "Found valid Wii U HMAC key."
if [ "$check_only" = false ]; then
echo "PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY=$wiiu_hmac_key" >>"$git_base/environment/boss.local.env"
if [ "$wiiu_hmac_key_hash" = "$expected_wiiu_hmac_key_hash" ]; then
success "Found valid Wii U HMAC key."
if [ "$check_only" = false ]; then
echo "PN_BOSS_CONFIG_BOSS_WIIU_HMAC_KEY=$wiiu_hmac_key" >>"$git_base/environment/boss.local.env"
fi
else
error "Wii U BOSS HMAC key has the wrong hash! Try re-running full_keys_dumper."
exit 1
fi
else
error "Wii U BOSS HMAC key has the wrong hash! Try re-running full_keys_dumper."
warning "console-files/boss_keys.bin (Wii U) not found! Please read the README for instructions on dumping your BOSS keys."
fi

ds_aes_key=$(grep -oP 'slot0x38KeyN=\K.*' ./aes_keys.txt)
ds_aes_key_bin=$(printf "%s" "$ds_aes_key" | xxd -r -p)
ds_aes_key_hash=$(printf "%s" "$ds_aes_key_bin" | md5sum | cut -d ' ' -f 1)

if [ "$ds_aes_key_hash" = "$expected_ds_aes_key_hash" ]; then
success "Found valid 3DS BOSS AES key."
if [ "$check_only" = false ]; then
echo "PN_BOSS_CONFIG_BOSS_3DS_AES_KEY=$ds_aes_key" >>"$git_base/environment/boss.local.env"
if ls ./aes_keys.txt 1>/dev/null 2>&1; then
ds_aes_key=$(grep -oP 'slot0x38KeyN=\K.*' ./aes_keys.txt)
ds_aes_key_bin=$(printf "%s" "$ds_aes_key" | xxd -r -p)
ds_aes_key_hash=$(printf "%s" "$ds_aes_key_bin" | md5sum | cut -d ' ' -f 1)

if [ "$ds_aes_key_hash" = "$expected_ds_aes_key_hash" ]; then
success "Found valid 3DS BOSS AES key."
if [ "$check_only" = false ]; then
echo "PN_BOSS_CONFIG_BOSS_3DS_AES_KEY=$ds_aes_key" >>"$git_base/environment/boss.local.env"
fi
else
error "3DS BOSS AES key has the wrong hash! Try re-running DumpKeys.gm9."
exit 1
fi
else
error "3DS BOSS AES key has the wrong hash! Try re-running DumpKeys.gm9."
warning "console-files/aes_keys.txt (3DS) not found! Please read the README for instructions on dumping your BOSS keys."
fi

0 comments on commit 35c9f4c

Please sign in to comment.