Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify NpTicket platform based on signature identifier instead of issuer ID #1062

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions ProjectLighthouse/Tickets/NPTicket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,13 @@ private static bool ReadTicket(NPTicket npTicket, TicketReader reader)

if (!ticketParser.ParseTicket()) return false;

// Create a uint in big endian
uint signatureIdentifier = (uint)(npTicket.TicketSignatureIdentifier[0] << 24 |
npTicket.TicketSignatureIdentifier[1] << 16 |
npTicket.TicketSignatureIdentifier[2] << 8 |
npTicket.TicketSignatureIdentifier[3]);

npTicket.SignatureVerifier = signatureIdentifier switch
npTicket.SignatureVerifier = npTicket.TicketSignatureIdentifier switch
{
0x5250434E => new RpcnSignatureVerifier(npTicket),
0x719F1D4A => new PsnSignatureVerifier(npTicket),
0x54455354 => new UnitTestSignatureVerifier(npTicket),
[0x71, 0x9F, 0x1D, 0x4A,] => new PsnSignatureVerifier(npTicket), // PSN LBP Signature Identifier
[0x52, 0x50, 0x43, 0x4E,] => new RpcnSignatureVerifier(npTicket), // 'RPCN' in ascii
[0x54, 0x45, 0x53, 0x54,] => new UnitTestSignatureVerifier(npTicket), // 'TEST' in ascii
_ => throw new ArgumentOutOfRangeException(nameof(npTicket),
signatureIdentifier,
npTicket.TicketSignatureIdentifier,
@"Invalid signature identifier"),
};

Expand Down Expand Up @@ -159,13 +153,11 @@ private static bool ReadTicket(NPTicket npTicket, TicketReader reader)
return null;
}

// Production PSN Issuer ID: 0x100
// RPCN Issuer ID: 0x33333333
npTicket.Platform = npTicket.IssuerId switch
npTicket.Platform = npTicket.SignatureVerifier switch
{
0x100 => Platform.PS3,
0x33333333 => Platform.RPCS3,
0x74657374 => Platform.UnitTest,
PsnSignatureVerifier => Platform.PS3,
RpcnSignatureVerifier => Platform.RPCS3,
UnitTestSignatureVerifier => Platform.UnitTest,
_ => Platform.Unknown,
};

Expand Down
Loading