From c667de116985840c35ac34b035c58515b0d72211 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Tue, 31 Jan 2023 23:53:33 -0700 Subject: [PATCH] Handle CryptographicExceptions when decrypting personalized tickets --- src/LibHac/Tools/Es/Ticket.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/LibHac/Tools/Es/Ticket.cs b/src/LibHac/Tools/Es/Ticket.cs index 19c6dc45..37552769 100644 --- a/src/LibHac/Tools/Es/Ticket.cs +++ b/src/LibHac/Tools/Es/Ticket.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Security.Cryptography; using LibHac.Common; using LibHac.Common.Keys; using LibHac.Tools.Crypto; @@ -160,7 +161,14 @@ public class Ticket if (keySet.ETicketRsaKey.PublicExponent.ItemsRo.IsZeros()) return null; - return CryptoOld.DecryptRsaOaep(TitleKeyBlock, keySet.ETicketRsaKeyParams); + try + { + return CryptoOld.DecryptRsaOaep(TitleKeyBlock, keySet.ETicketRsaKeyParams); + } + catch (CryptographicException) + { + return null; + } } }