fix: Enable extra cli output for titlekeys (when using titlekey crypto)

This commit is contained in:
emargee 2023-11-03 10:33:08 +00:00 committed by Alex Barney
parent 300fa877e4
commit 3f5cd08b68
2 changed files with 14 additions and 0 deletions

View File

@ -65,6 +65,18 @@ public class Nca
private static readonly string[] KakNames = { "application", "ocean", "system" };
public byte[] GetEncryptedTitleKey()
{
var rightsId = new RightsId(Header.RightsId);
if (KeySet.ExternalKeySet.Get(rightsId, out AccessKey accessKey).IsFailure())
{
throw new MissingKeyException("Missing NCA title key.", rightsId.ToString(), KeyType.Title);
}
return accessKey.Value.ToArray();
}
public byte[] GetDecryptedTitleKey()
{
int keyRevision = Utilities.GetMasterKeyRevision(Header.KeyGeneration);

View File

@ -346,6 +346,8 @@ internal static class ProcessNca
if (nca.Header.HasRightsId)
{
PrintItem(sb, colLen, "Rights ID:", nca.Header.RightsId.ToArray());
PrintItem(sb, colLen, "Titlekey (Encrypted):", nca.GetEncryptedTitleKey());
PrintItem(sb, colLen, "Titlekey (Decrypted):", nca.GetDecryptedTitleKey());
}
else
{