From 18bdd0f3eb9f5124f9821cc527d430a594597c65 Mon Sep 17 00:00:00 2001 From: Dmitry Isaenko Date: Tue, 21 May 2019 01:30:16 +0300 Subject: [PATCH] setup for 00-07 KAEK keys --- src/main/java/konogonka/AppPreferences.java | 14 ++++++- .../Controllers/NCA/NCAController.java | 2 +- .../Settings/SettingsController.java | 34 ++++++++++++++++- .../konogonka/Tools/NCA/NCAContentPFS0.java | 4 +- .../FXML/Settings/SettingsLayout.fxml | 38 ++++++++++++++++++- 5 files changed, 85 insertions(+), 7 deletions(-) diff --git a/src/main/java/konogonka/AppPreferences.java b/src/main/java/konogonka/AppPreferences.java index c0287e7..de2bc90 100644 --- a/src/main/java/konogonka/AppPreferences.java +++ b/src/main/java/konogonka/AppPreferences.java @@ -20,18 +20,24 @@ public class AppPreferences { String applicationKey3, String applicationKey4, String applicationKey5, + String applicationKey6, + String applicationKey7, String oceanKey0, String oceanKey1, String oceanKey2, String oceanKey3, String oceanKey4, String oceanKey5, + String oceanKey6, + String oceanKey7, String systemKey0, String systemKey1, String systemKey2, String systemKey3, String systemKey4, - String systemKey5 + String systemKey5, + String systemKey6, + String systemKey7 ) { setXciHeaderKey(xciHeaderKey); setHeaderKey(headerKey); @@ -42,6 +48,8 @@ public class AppPreferences { setApplicationKey(3, applicationKey3); setApplicationKey(4, applicationKey4); setApplicationKey(5, applicationKey5); + setApplicationKey(6, applicationKey6); + setApplicationKey(7, applicationKey7); setOceanKey(0, oceanKey0); setOceanKey(1, oceanKey1); @@ -49,6 +57,8 @@ public class AppPreferences { setOceanKey(3, oceanKey3); setOceanKey(4, oceanKey4); setOceanKey(5, oceanKey5); + setOceanKey(6, oceanKey6); + setOceanKey(7, oceanKey7); setSystemKey(0, systemKey0); setSystemKey(1, systemKey1); @@ -56,6 +66,8 @@ public class AppPreferences { setSystemKey(3, systemKey3); setSystemKey(4, systemKey4); setSystemKey(5, systemKey5); + setSystemKey(6, systemKey6); + setSystemKey(7, systemKey7); } public String getRecentPath(){return preferences.get("recent_path", System.getProperty("user.home"));} diff --git a/src/main/java/konogonka/Controllers/NCA/NCAController.java b/src/main/java/konogonka/Controllers/NCA/NCAController.java index fc32cc2..dd875c2 100644 --- a/src/main/java/konogonka/Controllers/NCA/NCAController.java +++ b/src/main/java/konogonka/Controllers/NCA/NCAController.java @@ -76,7 +76,7 @@ public class NCAController implements TabController { this.selectedFile = file; HashMap keysMap = new HashMap<>(); keysMap.put("header_key", AppPreferences.getInstance().getHeaderKey()); - for (int i = 0; i < 6; i++){ + for (int i = 0; i < 8; i++){ keysMap.put("key_area_key_application_0"+i, AppPreferences.getInstance().getApplicationKey(i)); keysMap.put("key_area_key_ocean_0"+i, AppPreferences.getInstance().getOceanKey(i)); keysMap.put("key_area_key_system_0"+i, AppPreferences.getInstance().getSystemKey(i)); diff --git a/src/main/java/konogonka/Settings/SettingsController.java b/src/main/java/konogonka/Settings/SettingsController.java index ef1908c..1c3a022 100644 --- a/src/main/java/konogonka/Settings/SettingsController.java +++ b/src/main/java/konogonka/Settings/SettingsController.java @@ -28,18 +28,24 @@ public class SettingsController implements Initializable { keyApp3TF, keyApp4TF, keyApp5TF, + keyApp6TF, + keyApp7TF, keyOcean0TF, keyOcean1TF, keyOcean2TF, keyOcean3TF, keyOcean4TF, keyOcean5TF, + keyOcean6TF, + keyOcean7TF, keySys0TF, keySys1TF, keySys2TF, keySys3TF, keySys4TF, - keySys5TF; + keySys5TF, + keySys6TF, + keySys7TF; @Override public void initialize(URL url, ResourceBundle resourceBundle) { @@ -51,18 +57,24 @@ public class SettingsController implements Initializable { keyApp3TF.setText(AppPreferences.getInstance().getApplicationKey(3)); keyApp4TF.setText(AppPreferences.getInstance().getApplicationKey(4)); keyApp5TF.setText(AppPreferences.getInstance().getApplicationKey(5)); + keyApp6TF.setText(AppPreferences.getInstance().getApplicationKey(6)); + keyApp7TF.setText(AppPreferences.getInstance().getApplicationKey(7)); keyOcean0TF.setText(AppPreferences.getInstance().getOceanKey(0)); keyOcean1TF.setText(AppPreferences.getInstance().getOceanKey(1)); keyOcean2TF.setText(AppPreferences.getInstance().getOceanKey(2)); keyOcean3TF.setText(AppPreferences.getInstance().getOceanKey(3)); keyOcean4TF.setText(AppPreferences.getInstance().getOceanKey(4)); keyOcean5TF.setText(AppPreferences.getInstance().getOceanKey(5)); + keyOcean6TF.setText(AppPreferences.getInstance().getOceanKey(6)); + keyOcean7TF.setText(AppPreferences.getInstance().getOceanKey(7)); keySys0TF.setText(AppPreferences.getInstance().getSystemKey(0)); keySys1TF.setText(AppPreferences.getInstance().getSystemKey(1)); keySys2TF.setText(AppPreferences.getInstance().getSystemKey(2)); keySys3TF.setText(AppPreferences.getInstance().getSystemKey(3)); keySys4TF.setText(AppPreferences.getInstance().getSystemKey(4)); keySys5TF.setText(AppPreferences.getInstance().getSystemKey(5)); + keySys6TF.setText(AppPreferences.getInstance().getSystemKey(6)); + keySys7TF.setText(AppPreferences.getInstance().getSystemKey(7)); setTextValidation(xciHdrKeyTF); setTextValidation(hdrKeyTF); @@ -72,18 +84,24 @@ public class SettingsController implements Initializable { setTextValidation(keyApp3TF); setTextValidation(keyApp4TF); setTextValidation(keyApp5TF); + setTextValidation(keyApp6TF); + setTextValidation(keyApp7TF); setTextValidation(keyOcean0TF); setTextValidation(keyOcean1TF); setTextValidation(keyOcean2TF); setTextValidation(keyOcean3TF); setTextValidation(keyOcean4TF); setTextValidation(keyOcean5TF); + setTextValidation(keyOcean6TF); + setTextValidation(keyOcean7TF); setTextValidation(keySys0TF); setTextValidation(keySys1TF); setTextValidation(keySys2TF); setTextValidation(keySys3TF); setTextValidation(keySys4TF); setTextValidation(keySys5TF); + setTextValidation(keySys6TF); + setTextValidation(keySys7TF); importBtn.setOnAction(e->{ FileChooser fileChooser = new FileChooser(); @@ -114,18 +132,24 @@ public class SettingsController implements Initializable { keyApp3TF.setText(fileMap.get("key_area_key_application_03")); keyApp4TF.setText(fileMap.get("key_area_key_application_04")); keyApp5TF.setText(fileMap.get("key_area_key_application_05")); + keyApp6TF.setText(fileMap.get("key_area_key_application_06")); + keyApp7TF.setText(fileMap.get("key_area_key_application_07")); keyOcean0TF.setText(fileMap.get("key_area_key_ocean_00")); keyOcean1TF.setText(fileMap.get("key_area_key_ocean_01")); keyOcean2TF.setText(fileMap.get("key_area_key_ocean_02")); keyOcean3TF.setText(fileMap.get("key_area_key_ocean_03")); keyOcean4TF.setText(fileMap.get("key_area_key_ocean_04")); keyOcean5TF.setText(fileMap.get("key_area_key_ocean_05")); + keyOcean6TF.setText(fileMap.get("key_area_key_ocean_06")); + keyOcean7TF.setText(fileMap.get("key_area_key_ocean_07")); keySys0TF.setText(fileMap.get("key_area_key_system_00")); keySys1TF.setText(fileMap.get("key_area_key_system_01")); keySys2TF.setText(fileMap.get("key_area_key_system_02")); keySys3TF.setText(fileMap.get("key_area_key_system_03")); keySys4TF.setText(fileMap.get("key_area_key_system_04")); keySys5TF.setText(fileMap.get("key_area_key_system_05")); + keySys6TF.setText(fileMap.get("key_area_key_system_06")); + keySys7TF.setText(fileMap.get("key_area_key_system_07")); } catch (IOException ioe){ ioe.printStackTrace(); @@ -155,18 +179,24 @@ public class SettingsController implements Initializable { keyApp3TF.getText(), keyApp4TF.getText(), keyApp5TF.getText(), + keyApp6TF.getText(), + keyApp7TF.getText(), keyOcean0TF.getText(), keyOcean1TF.getText(), keyOcean2TF.getText(), keyOcean3TF.getText(), keyOcean4TF.getText(), keyOcean5TF.getText(), + keyOcean6TF.getText(), + keyOcean7TF.getText(), keySys0TF.getText(), keySys1TF.getText(), keySys2TF.getText(), keySys3TF.getText(), keySys4TF.getText(), - keySys5TF.getText() + keySys5TF.getText(), + keySys6TF.getText(), + keySys7TF.getText() ); thisStage.close(); }); diff --git a/src/main/java/konogonka/Tools/NCA/NCAContentPFS0.java b/src/main/java/konogonka/Tools/NCA/NCAContentPFS0.java index 24cbd4e..4dd5e21 100644 --- a/src/main/java/konogonka/Tools/NCA/NCAContentPFS0.java +++ b/src/main/java/konogonka/Tools/NCA/NCAContentPFS0.java @@ -57,7 +57,7 @@ public class NCAContentPFS0 { System.out.println("SHA256 records: " + (ncaSectionBlock.getSuperBlockPFS0().getHashTableSize() / 0x20)); System.out.println("KEY: " + LoperConverter.byteArrToHexString(decryptedKey)); System.out.println("CTR: " + LoperConverter.byteArrToHexString(ncaSectionBlock.getSectionCTR())); - System.out.println("PFS0 Offs: "+ncaSectionBlock.getSuperBlockPFS0().getPfs0offset()); + System.out.println("PFS0 Offs: " + ncaSectionBlock.getSuperBlockPFS0().getPfs0offset()); System.out.println(); //-------------------------------------------------------------------------------------------------- long thisMediaLocation = offsetPosition + (ncaHeaderTableEntry.getMediaStartOffset() * 0x200); // According to real file @@ -159,7 +159,7 @@ public class NCAContentPFS0 { try{ if (hashTableOffset > 0){ while (counter < hashTableOffset) { - pipedInputStream.read(); + pipedInputStream.read(); // todo: .skip() counter++; } } diff --git a/src/main/resources/FXML/Settings/SettingsLayout.fxml b/src/main/resources/FXML/Settings/SettingsLayout.fxml index 0b0636a..5094ea2 100644 --- a/src/main/resources/FXML/Settings/SettingsLayout.fxml +++ b/src/main/resources/FXML/Settings/SettingsLayout.fxml @@ -13,7 +13,7 @@ - + @@ -80,6 +80,18 @@ + + + + + + + + + + + + + + + + + + + + + + + +