setup for 00-07 KAEK keys

This commit is contained in:
Dmitry Isaenko 2019-05-21 01:30:16 +03:00
parent e4c9035a34
commit 18bdd0f3eb
5 changed files with 85 additions and 7 deletions

View file

@ -20,18 +20,24 @@ public class AppPreferences {
String applicationKey3, String applicationKey3,
String applicationKey4, String applicationKey4,
String applicationKey5, String applicationKey5,
String applicationKey6,
String applicationKey7,
String oceanKey0, String oceanKey0,
String oceanKey1, String oceanKey1,
String oceanKey2, String oceanKey2,
String oceanKey3, String oceanKey3,
String oceanKey4, String oceanKey4,
String oceanKey5, String oceanKey5,
String oceanKey6,
String oceanKey7,
String systemKey0, String systemKey0,
String systemKey1, String systemKey1,
String systemKey2, String systemKey2,
String systemKey3, String systemKey3,
String systemKey4, String systemKey4,
String systemKey5 String systemKey5,
String systemKey6,
String systemKey7
) { ) {
setXciHeaderKey(xciHeaderKey); setXciHeaderKey(xciHeaderKey);
setHeaderKey(headerKey); setHeaderKey(headerKey);
@ -42,6 +48,8 @@ public class AppPreferences {
setApplicationKey(3, applicationKey3); setApplicationKey(3, applicationKey3);
setApplicationKey(4, applicationKey4); setApplicationKey(4, applicationKey4);
setApplicationKey(5, applicationKey5); setApplicationKey(5, applicationKey5);
setApplicationKey(6, applicationKey6);
setApplicationKey(7, applicationKey7);
setOceanKey(0, oceanKey0); setOceanKey(0, oceanKey0);
setOceanKey(1, oceanKey1); setOceanKey(1, oceanKey1);
@ -49,6 +57,8 @@ public class AppPreferences {
setOceanKey(3, oceanKey3); setOceanKey(3, oceanKey3);
setOceanKey(4, oceanKey4); setOceanKey(4, oceanKey4);
setOceanKey(5, oceanKey5); setOceanKey(5, oceanKey5);
setOceanKey(6, oceanKey6);
setOceanKey(7, oceanKey7);
setSystemKey(0, systemKey0); setSystemKey(0, systemKey0);
setSystemKey(1, systemKey1); setSystemKey(1, systemKey1);
@ -56,6 +66,8 @@ public class AppPreferences {
setSystemKey(3, systemKey3); setSystemKey(3, systemKey3);
setSystemKey(4, systemKey4); setSystemKey(4, systemKey4);
setSystemKey(5, systemKey5); setSystemKey(5, systemKey5);
setSystemKey(6, systemKey6);
setSystemKey(7, systemKey7);
} }
public String getRecentPath(){return preferences.get("recent_path", System.getProperty("user.home"));} public String getRecentPath(){return preferences.get("recent_path", System.getProperty("user.home"));}

View file

@ -76,7 +76,7 @@ public class NCAController implements TabController {
this.selectedFile = file; this.selectedFile = file;
HashMap<String, String> keysMap = new HashMap<>(); HashMap<String, String> keysMap = new HashMap<>();
keysMap.put("header_key", AppPreferences.getInstance().getHeaderKey()); 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_application_0"+i, AppPreferences.getInstance().getApplicationKey(i));
keysMap.put("key_area_key_ocean_0"+i, AppPreferences.getInstance().getOceanKey(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)); keysMap.put("key_area_key_system_0"+i, AppPreferences.getInstance().getSystemKey(i));

View file

@ -28,18 +28,24 @@ public class SettingsController implements Initializable {
keyApp3TF, keyApp3TF,
keyApp4TF, keyApp4TF,
keyApp5TF, keyApp5TF,
keyApp6TF,
keyApp7TF,
keyOcean0TF, keyOcean0TF,
keyOcean1TF, keyOcean1TF,
keyOcean2TF, keyOcean2TF,
keyOcean3TF, keyOcean3TF,
keyOcean4TF, keyOcean4TF,
keyOcean5TF, keyOcean5TF,
keyOcean6TF,
keyOcean7TF,
keySys0TF, keySys0TF,
keySys1TF, keySys1TF,
keySys2TF, keySys2TF,
keySys3TF, keySys3TF,
keySys4TF, keySys4TF,
keySys5TF; keySys5TF,
keySys6TF,
keySys7TF;
@Override @Override
public void initialize(URL url, ResourceBundle resourceBundle) { public void initialize(URL url, ResourceBundle resourceBundle) {
@ -51,18 +57,24 @@ public class SettingsController implements Initializable {
keyApp3TF.setText(AppPreferences.getInstance().getApplicationKey(3)); keyApp3TF.setText(AppPreferences.getInstance().getApplicationKey(3));
keyApp4TF.setText(AppPreferences.getInstance().getApplicationKey(4)); keyApp4TF.setText(AppPreferences.getInstance().getApplicationKey(4));
keyApp5TF.setText(AppPreferences.getInstance().getApplicationKey(5)); keyApp5TF.setText(AppPreferences.getInstance().getApplicationKey(5));
keyApp6TF.setText(AppPreferences.getInstance().getApplicationKey(6));
keyApp7TF.setText(AppPreferences.getInstance().getApplicationKey(7));
keyOcean0TF.setText(AppPreferences.getInstance().getOceanKey(0)); keyOcean0TF.setText(AppPreferences.getInstance().getOceanKey(0));
keyOcean1TF.setText(AppPreferences.getInstance().getOceanKey(1)); keyOcean1TF.setText(AppPreferences.getInstance().getOceanKey(1));
keyOcean2TF.setText(AppPreferences.getInstance().getOceanKey(2)); keyOcean2TF.setText(AppPreferences.getInstance().getOceanKey(2));
keyOcean3TF.setText(AppPreferences.getInstance().getOceanKey(3)); keyOcean3TF.setText(AppPreferences.getInstance().getOceanKey(3));
keyOcean4TF.setText(AppPreferences.getInstance().getOceanKey(4)); keyOcean4TF.setText(AppPreferences.getInstance().getOceanKey(4));
keyOcean5TF.setText(AppPreferences.getInstance().getOceanKey(5)); keyOcean5TF.setText(AppPreferences.getInstance().getOceanKey(5));
keyOcean6TF.setText(AppPreferences.getInstance().getOceanKey(6));
keyOcean7TF.setText(AppPreferences.getInstance().getOceanKey(7));
keySys0TF.setText(AppPreferences.getInstance().getSystemKey(0)); keySys0TF.setText(AppPreferences.getInstance().getSystemKey(0));
keySys1TF.setText(AppPreferences.getInstance().getSystemKey(1)); keySys1TF.setText(AppPreferences.getInstance().getSystemKey(1));
keySys2TF.setText(AppPreferences.getInstance().getSystemKey(2)); keySys2TF.setText(AppPreferences.getInstance().getSystemKey(2));
keySys3TF.setText(AppPreferences.getInstance().getSystemKey(3)); keySys3TF.setText(AppPreferences.getInstance().getSystemKey(3));
keySys4TF.setText(AppPreferences.getInstance().getSystemKey(4)); keySys4TF.setText(AppPreferences.getInstance().getSystemKey(4));
keySys5TF.setText(AppPreferences.getInstance().getSystemKey(5)); keySys5TF.setText(AppPreferences.getInstance().getSystemKey(5));
keySys6TF.setText(AppPreferences.getInstance().getSystemKey(6));
keySys7TF.setText(AppPreferences.getInstance().getSystemKey(7));
setTextValidation(xciHdrKeyTF); setTextValidation(xciHdrKeyTF);
setTextValidation(hdrKeyTF); setTextValidation(hdrKeyTF);
@ -72,18 +84,24 @@ public class SettingsController implements Initializable {
setTextValidation(keyApp3TF); setTextValidation(keyApp3TF);
setTextValidation(keyApp4TF); setTextValidation(keyApp4TF);
setTextValidation(keyApp5TF); setTextValidation(keyApp5TF);
setTextValidation(keyApp6TF);
setTextValidation(keyApp7TF);
setTextValidation(keyOcean0TF); setTextValidation(keyOcean0TF);
setTextValidation(keyOcean1TF); setTextValidation(keyOcean1TF);
setTextValidation(keyOcean2TF); setTextValidation(keyOcean2TF);
setTextValidation(keyOcean3TF); setTextValidation(keyOcean3TF);
setTextValidation(keyOcean4TF); setTextValidation(keyOcean4TF);
setTextValidation(keyOcean5TF); setTextValidation(keyOcean5TF);
setTextValidation(keyOcean6TF);
setTextValidation(keyOcean7TF);
setTextValidation(keySys0TF); setTextValidation(keySys0TF);
setTextValidation(keySys1TF); setTextValidation(keySys1TF);
setTextValidation(keySys2TF); setTextValidation(keySys2TF);
setTextValidation(keySys3TF); setTextValidation(keySys3TF);
setTextValidation(keySys4TF); setTextValidation(keySys4TF);
setTextValidation(keySys5TF); setTextValidation(keySys5TF);
setTextValidation(keySys6TF);
setTextValidation(keySys7TF);
importBtn.setOnAction(e->{ importBtn.setOnAction(e->{
FileChooser fileChooser = new FileChooser(); FileChooser fileChooser = new FileChooser();
@ -114,18 +132,24 @@ public class SettingsController implements Initializable {
keyApp3TF.setText(fileMap.get("key_area_key_application_03")); keyApp3TF.setText(fileMap.get("key_area_key_application_03"));
keyApp4TF.setText(fileMap.get("key_area_key_application_04")); keyApp4TF.setText(fileMap.get("key_area_key_application_04"));
keyApp5TF.setText(fileMap.get("key_area_key_application_05")); 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")); keyOcean0TF.setText(fileMap.get("key_area_key_ocean_00"));
keyOcean1TF.setText(fileMap.get("key_area_key_ocean_01")); keyOcean1TF.setText(fileMap.get("key_area_key_ocean_01"));
keyOcean2TF.setText(fileMap.get("key_area_key_ocean_02")); keyOcean2TF.setText(fileMap.get("key_area_key_ocean_02"));
keyOcean3TF.setText(fileMap.get("key_area_key_ocean_03")); keyOcean3TF.setText(fileMap.get("key_area_key_ocean_03"));
keyOcean4TF.setText(fileMap.get("key_area_key_ocean_04")); keyOcean4TF.setText(fileMap.get("key_area_key_ocean_04"));
keyOcean5TF.setText(fileMap.get("key_area_key_ocean_05")); 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")); keySys0TF.setText(fileMap.get("key_area_key_system_00"));
keySys1TF.setText(fileMap.get("key_area_key_system_01")); keySys1TF.setText(fileMap.get("key_area_key_system_01"));
keySys2TF.setText(fileMap.get("key_area_key_system_02")); keySys2TF.setText(fileMap.get("key_area_key_system_02"));
keySys3TF.setText(fileMap.get("key_area_key_system_03")); keySys3TF.setText(fileMap.get("key_area_key_system_03"));
keySys4TF.setText(fileMap.get("key_area_key_system_04")); keySys4TF.setText(fileMap.get("key_area_key_system_04"));
keySys5TF.setText(fileMap.get("key_area_key_system_05")); 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){ catch (IOException ioe){
ioe.printStackTrace(); ioe.printStackTrace();
@ -155,18 +179,24 @@ public class SettingsController implements Initializable {
keyApp3TF.getText(), keyApp3TF.getText(),
keyApp4TF.getText(), keyApp4TF.getText(),
keyApp5TF.getText(), keyApp5TF.getText(),
keyApp6TF.getText(),
keyApp7TF.getText(),
keyOcean0TF.getText(), keyOcean0TF.getText(),
keyOcean1TF.getText(), keyOcean1TF.getText(),
keyOcean2TF.getText(), keyOcean2TF.getText(),
keyOcean3TF.getText(), keyOcean3TF.getText(),
keyOcean4TF.getText(), keyOcean4TF.getText(),
keyOcean5TF.getText(), keyOcean5TF.getText(),
keyOcean6TF.getText(),
keyOcean7TF.getText(),
keySys0TF.getText(), keySys0TF.getText(),
keySys1TF.getText(), keySys1TF.getText(),
keySys2TF.getText(), keySys2TF.getText(),
keySys3TF.getText(), keySys3TF.getText(),
keySys4TF.getText(), keySys4TF.getText(),
keySys5TF.getText() keySys5TF.getText(),
keySys6TF.getText(),
keySys7TF.getText()
); );
thisStage.close(); thisStage.close();
}); });

View file

@ -57,7 +57,7 @@ public class NCAContentPFS0 {
System.out.println("SHA256 records: " + (ncaSectionBlock.getSuperBlockPFS0().getHashTableSize() / 0x20)); System.out.println("SHA256 records: " + (ncaSectionBlock.getSuperBlockPFS0().getHashTableSize() / 0x20));
System.out.println("KEY: " + LoperConverter.byteArrToHexString(decryptedKey)); System.out.println("KEY: " + LoperConverter.byteArrToHexString(decryptedKey));
System.out.println("CTR: " + LoperConverter.byteArrToHexString(ncaSectionBlock.getSectionCTR())); 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(); System.out.println();
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
long thisMediaLocation = offsetPosition + (ncaHeaderTableEntry.getMediaStartOffset() * 0x200); // According to real file long thisMediaLocation = offsetPosition + (ncaHeaderTableEntry.getMediaStartOffset() * 0x200); // According to real file
@ -159,7 +159,7 @@ public class NCAContentPFS0 {
try{ try{
if (hashTableOffset > 0){ if (hashTableOffset > 0){
while (counter < hashTableOffset) { while (counter < hashTableOffset) {
pipedInputStream.read(); pipedInputStream.read(); // todo: .skip()
counter++; counter++;
} }
} }

View file

@ -13,7 +13,7 @@
<?import javafx.scene.layout.VBox?> <?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.SVGPath?> <?import javafx.scene.shape.SVGPath?>
<AnchorPane prefHeight="600.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="konogonka.Settings.SettingsController"> <AnchorPane prefHeight="600.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="konogonka.Settings.SettingsController">
<children> <children>
<VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <VBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <children>
@ -80,6 +80,18 @@
<TextField fx:id="keyApp5TF" HBox.hgrow="ALWAYS" /> <TextField fx:id="keyApp5TF" HBox.hgrow="ALWAYS" />
</children> </children>
</HBox> </HBox>
<HBox spacing="5.0">
<children>
<Label text="key_area_key_application_06" />
<TextField fx:id="keyApp6TF" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox spacing="5.0">
<children>
<Label text="key_area_key_application_07" />
<TextField fx:id="keyApp7TF" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox spacing="5.0"> <HBox spacing="5.0">
<children> <children>
<Label text="key_area_key_ocean_00" /> <Label text="key_area_key_ocean_00" />
@ -116,6 +128,18 @@
<TextField fx:id="keyOcean5TF" HBox.hgrow="ALWAYS" /> <TextField fx:id="keyOcean5TF" HBox.hgrow="ALWAYS" />
</children> </children>
</HBox> </HBox>
<HBox spacing="5.0">
<children>
<Label text="key_area_key_ocean_06" />
<TextField fx:id="keyOcean6TF" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox spacing="5.0">
<children>
<Label text="key_area_key_ocean_07" />
<TextField fx:id="keyOcean7TF" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox spacing="5.0"> <HBox spacing="5.0">
<children> <children>
<Label text="key_area_key_system_00" /> <Label text="key_area_key_system_00" />
@ -152,6 +176,18 @@
<TextField fx:id="keySys5TF" HBox.hgrow="ALWAYS" /> <TextField fx:id="keySys5TF" HBox.hgrow="ALWAYS" />
</children> </children>
</HBox> </HBox>
<HBox spacing="5.0">
<children>
<Label text="key_area_key_system_06" />
<TextField fx:id="keySys6TF" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<HBox spacing="5.0">
<children>
<Label text="key_area_key_system_07" />
<TextField fx:id="keySys7TF" HBox.hgrow="ALWAYS" />
</children>
</HBox>
<Separator prefWidth="200.0" /> <Separator prefWidth="200.0" />
</children> </children>
<padding> <padding>