hactoolnet: Load personalized tickets if possible

This commit is contained in:
Alex Barney 2023-01-31 23:13:36 -07:00
parent 754df0dcd9
commit 8c4f0b7e42

View file

@ -23,14 +23,15 @@ internal static class ProcessAppFs
var ticket = new Ticket(tikFile.Get.AsStream());
if (ticket.TitleKeyType != TitleKeyType.Common)
continue;
if (ticket.RightsId.IsZeros())
continue;
byte[] key = ticket.GetTitleKey(ctx.KeySet);
if (key is null)
continue;
var rightsId = SpanHelpers.AsStruct<RightsId>(ticket.RightsId);
var accessKey = SpanHelpers.AsStruct<AccessKey>(ticket.TitleKeyBlock);
var accessKey = SpanHelpers.AsStruct<AccessKey>(key);
ctx.KeySet.ExternalKeySet.Add(rightsId, accessKey).ThrowIfFailure();
}