Skip to content

Commit

Permalink
Added support for encrypted ISOs (#995)
Browse files Browse the repository at this point in the history
Will copy the key if it is available from external NTFS/exFAT HDD with the same name as the ISO to decrypt it on-the-fly with Cobra when the ISO is mounted
  • Loading branch information
Evilnat authored Dec 27, 2023
1 parent 339276f commit 55de62f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions _Projects_/prepISO/include/exfat.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,32 @@ static int dir_read (char *dpath)
continue;
}
//---------------

// If the key exists, copy it to "/dev_hdd0/tmp/wmtmp" to
// decrypt on-the-fly with Cobra when the ISO is mounted (By Evilnat)
if(strcasestr(ext, ".key"))
{
FIL fd;
char output[256];
snprintf (fn, 255, "%s/%s", dpath, fno.fname);
sprintf(output, "/dev_hdd0/tmp/wmtmp/%s", fno.fname);

if (!f_open(&fd, fn, FA_READ))
{
UINT re;
uint8_t data[0x10];
f_read(&fd, data, 0x10, &re);
f_close (&fd);

int fda = ps3ntfs_open(output, O_WRONLY | O_CREAT | O_TRUNC, 0777);
if(fda >= 0)
{
ps3ntfs_write(fda, (void *)data, 0x10);
ps3ntfs_close(fda);
}
}

}

//--- is ISO?
is_iso = ( (strcasestr(ext, ".iso")) ) ||
Expand Down

0 comments on commit 55de62f

Please sign in to comment.