Handle CryptographicExceptions when decrypting personalized tickets

This commit is contained in:
Alex Barney 2023-01-31 23:53:33 -07:00
parent 7ee5aec746
commit c667de1169

View file

@ -1,5 +1,6 @@
using System; using System;
using System.IO; using System.IO;
using System.Security.Cryptography;
using LibHac.Common; using LibHac.Common;
using LibHac.Common.Keys; using LibHac.Common.Keys;
using LibHac.Tools.Crypto; using LibHac.Tools.Crypto;
@ -160,7 +161,14 @@ public class Ticket
if (keySet.ETicketRsaKey.PublicExponent.ItemsRo.IsZeros()) if (keySet.ETicketRsaKey.PublicExponent.ItemsRo.IsZeros())
return null; return null;
return CryptoOld.DecryptRsaOaep(TitleKeyBlock, keySet.ETicketRsaKeyParams); try
{
return CryptoOld.DecryptRsaOaep(TitleKeyBlock, keySet.ETicketRsaKeyParams);
}
catch (CryptographicException)
{
return null;
}
} }
} }