mirror of
https://github.com/DarkStore-3DS/Project_CTR.git
synced 2026-07-05 08:49: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)
|
if(usrset->cia.randomTitleKey)
|
||||||
rndset(ciaset->common.titleKey,AES_128_KEY_SIZE);
|
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
|
else
|
||||||
clrmem(ciaset->common.titleKey,AES_128_KEY_SIZE);
|
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);
|
SetLimits(hdr,ciaset);
|
||||||
|
|
||||||
// Crypt TitleKey
|
// Crypt TitleKey
|
||||||
if(ciaset->content.encryptCia)
|
if(ciaset->content.encryptCia || ciaset->common.titleKey)
|
||||||
CryptTitleKey(ciaset->common.titleKey, hdr->encryptedTitleKey, hdr->titleId, ciaset->keys, ENC);
|
CryptTitleKey(ciaset->common.titleKey, hdr->encryptedTitleKey, hdr->titleId, ciaset->keys, ENC);
|
||||||
else
|
else
|
||||||
rndset(hdr->encryptedTitleKey,AES_128_KEY_SIZE);
|
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;
|
set->cia.randomTitleKey = true;
|
||||||
return 1;
|
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) {
|
else if (strcmp(argv[i], "-dlc") == 0) {
|
||||||
if (ParamNum) {
|
if (ParamNum) {
|
||||||
PrintNoNeedParam(argv[i]);
|
PrintNoNeedParam(argv[i]);
|
||||||
@@ -990,6 +998,7 @@ void DisplayExtendedHelp(char *app_name)
|
|||||||
printf(" -dver <version> Data-title version\n");
|
printf(" -dver <version> Data-title version\n");
|
||||||
printf(" -deviceid <hex id> 3DS unique device ID\n");
|
printf(" -deviceid <hex id> 3DS unique device ID\n");
|
||||||
printf(" -esaccid <hex id> e-Shop account 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(" -rand Use a random title key\n");
|
||||||
printf(" -dlc Create DLC CIA\n");
|
printf(" -dlc Create DLC CIA\n");
|
||||||
printf(" -srl <srl file> Package a TWL SRL in a CIA\n");
|
printf(" -srl <srl file> Package a TWL SRL in a CIA\n");
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ typedef struct
|
|||||||
|
|
||||||
struct{
|
struct{
|
||||||
bool randomTitleKey;
|
bool randomTitleKey;
|
||||||
|
char *titleKey;
|
||||||
bool encryptCia;
|
bool encryptCia;
|
||||||
bool DlcContent;
|
bool DlcContent;
|
||||||
bool includeUpdateNcch;
|
bool includeUpdateNcch;
|
||||||
|
|||||||
Reference in New Issue
Block a user