public void Open() { DiskInfo disk = SelectedDisk; var storage = new CachedStorage(new DeviceStream(disk.PhysicalName, disk.Length).AsStorage(), disk.SectorSize * 100, 4, true); storage.SetReadOnly(); Stream stream = storage.AsStream(); Keyset keyset = OpenKeyset(); var nand = new Nand(stream, keyset); Stream prodinfo = nand.OpenProdInfo(); var calibration = new Calibration(prodinfo); keyset.EticketExtKeyRsa = Crypto.DecryptRsaKey(calibration.EticketExtKeyRsa, keyset.EticketRsaKek); Ticket[] tickets = GetTickets(keyset, nand); using (var outStream = new StreamWriter("titlekeys.txt")) { foreach (Ticket ticket in tickets) { byte[] key = ticket.GetTitleKey(keyset); outStream.WriteLine($"{ticket.RightsId.ToHexString()},{key.ToHexString()}"); } } }
public Stream OpenProdInfo() { IStorage encStorage = ProdInfo.Open().AsStorage(); var decStorage = new CachedStorage(new Aes128XtsStorage(encStorage, Keyset.BisKeys[0], 0x4000, true), 0x4000, 4, true); decStorage.SetReadOnly(); return(decStorage.AsStream()); }
public NandPartition OpenUserPartition() { IStorage encStorage = User.Open().AsStorage(); var decStorage = new CachedStorage(new Aes128XtsStorage(encStorage, Keyset.BisKeys[3], 0x4000, true), 0x4000, 4, true); decStorage.SetReadOnly(); var fat = new FatFileSystem(decStorage.AsStream(), Ownership.None); return(new NandPartition(fat)); }