ROM Hack [Wip Release] ctrcdnfetch - Tool to download 3DS eshop content after 11.8

luigoalma

Member
OP
Newcomer
Joined
Sep 9, 2015
Messages
17
Trophies
0
Age
25
XP
336
Country
Portugal
I want to make an analogue of the program in Python. I have a question. What data from the original ticket should be sent to the Nintendo server so that it allowed downloading the content?
The full ticket must be sent, it must be signed and match the title id of content.
Encrypt ticket with a random 128bit key and iv and AES CBC 128, then take the used key and iv concated respectively together, and encrypt them RSA CDN Modulus with PKCS#1 v1.5, Block type 1 to match 3ds's work (not Block type 2, modules seem to use this always, I've tried to make this tool in python originally but I didn't bother too much with RSA, didn't find seem to find one that let me set block type or I was blind, I've not tested server response to Block type 2 but, 3ds uses type 1, so sending with type 2 would indicate something's up if they perform checks).
Take both encrypted results, and convert them to base64.
The final result has to be sent every time access to the content or tmd is made as http headers.
"X-Authentication-Key" shall contain the base64 encrypted key and iv used for ticket.
"X-Authentication-Data" shall contain the base64 encrypted ticket.
It's recommended to use a new randomized key and iv per new session, as NIM would get a random one as well per AM request of a wrapped ticket.
 

luigoalma

Member
OP
Newcomer
Joined
Sep 9, 2015
Messages
17
Trophies
0
Age
25
XP
336
Country
Portugal
You might want to read about tickets if you haven't yet.
Although the issuer is what says what key was used for signature, the common ticket RSA certificate used is XS0000000c (in retail). This can be verified, as the common issuer should be "Root-CA00000003-XS0000000c". AFAIK no other issuers are seen in retail.
It's just RSA. You can load ticket, find the proper data offset (read what was linked). And check data against the attached signature and with proper certificate RSA modulus.
Also forgot to mention earlier, the RSA exponent is 0x10001 in all cases here.
 
  • Like
Reactions: cearp

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    K3Nv2 @ K3Nv2: Keep current Gen consoles stock mod last gen imo