mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-02 16:59:03 +00:00
Add support for custom decrypted TitleKey
This commit is contained in:
@@ -184,6 +184,12 @@ int GetSettingsFromUsrset(cia_settings *ciaset, user_settings *usrset)
|
||||
|
||||
if(usrset->cia.randomTitleKey)
|
||||
rndset(ciaset->common.titleKey,AES_128_KEY_SIZE);
|
||||
else if(usrset->cia.titleKey){
|
||||
for (size_t count = 0; count < sizeof(ciaset->common.titleKey)/sizeof(ciaset->common.titleKey[0]); count++) {
|
||||
sscanf(usrset->cia.titleKey, "%2hhx", &ciaset->common.titleKey[count]);
|
||||
usrset->cia.titleKey += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
clrmem(ciaset->common.titleKey,AES_128_KEY_SIZE);
|
||||
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ void SetupTicketHeader(tik_hdr *hdr, cia_settings *ciaset)
|
||||
SetLimits(hdr,ciaset);
|
||||
|
||||
// Crypt TitleKey
|
||||
if(ciaset->content.encryptCia)
|
||||
if(ciaset->content.encryptCia || ciaset->common.titleKey)
|
||||
CryptTitleKey(ciaset->common.titleKey, hdr->encryptedTitleKey, hdr->titleId, ciaset->keys, ENC);
|
||||
else
|
||||
rndset(hdr->encryptedTitleKey,AES_128_KEY_SIZE);
|
||||
|
||||
@@ -559,6 +559,14 @@ int SetArgument(int argc, int i, char *argv[], user_settings *set)
|
||||
set->cia.randomTitleKey = true;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-titlekey") == 0) {
|
||||
if (ParamNum != 1) {
|
||||
PrintArgReqParam(argv[i], 1);
|
||||
return USR_ARG_REQ_PARAM;
|
||||
}
|
||||
set->cia.titleKey = argv[i + 1];
|
||||
return 2;
|
||||
}
|
||||
else if (strcmp(argv[i], "-dlc") == 0) {
|
||||
if (ParamNum) {
|
||||
PrintNoNeedParam(argv[i]);
|
||||
@@ -990,6 +998,7 @@ void DisplayExtendedHelp(char *app_name)
|
||||
printf(" -dver <version> Data-title version\n");
|
||||
printf(" -deviceid <hex id> 3DS unique device ID\n");
|
||||
printf(" -esaccid <hex id> e-Shop account ID\n");
|
||||
printf(" -titlekey <titlekey> Specify decrypted title key\n");
|
||||
printf(" -rand Use a random title key\n");
|
||||
printf(" -dlc Create DLC CIA\n");
|
||||
printf(" -srl <srl file> Package a TWL SRL in a CIA\n");
|
||||
|
||||
@@ -284,6 +284,7 @@ typedef struct
|
||||
|
||||
struct{
|
||||
bool randomTitleKey;
|
||||
char *titleKey;
|
||||
bool encryptCia;
|
||||
bool DlcContent;
|
||||
bool includeUpdateNcch;
|
||||
|
||||
Reference in New Issue
Block a user