NCCH: Difference between revisions

Wwylele (talk | contribs)
Encryption: Just document the encryption stuff here instead of external link
TimmSkiller (talk | contribs)
Small refactor, add form type and content type, fix ncchflags[5]
 
(One intermediate revision by one other user not shown)
Line 235: Line 235:


=== NCCH Flags ===
=== NCCH Flags ===
==== Content Type ====
{| class="wikitable" border="1"
|-
! Value !! Description
|-
| 0 || Unspecified
|-
| 1 || System Update
|-
| 2 || Instruction Manual
|-
| 3 || Download Play Child
|-
| 4 || Trial (Demo)
|-
| 5 || Extended System Update
|}
==== Form Type ====
{| class="wikitable" border="1"
|-
! Value !! Description
|-
| 0 || Not Assigned
|-
| 1 || Simple Content
|-
| 2 || Executable without RomFS
|-
| 3 || Executable
|}
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 247: Line 280:
|-
|-
|  5
|  5
|  Content Type Bit-masks: Data = 0x1, Executable = 0x2, SystemUpdate = 0x4, Manual = 0x8, Child = (0x4<nowiki>|</nowiki>0x8), Trial = 0x10. When 'Data' is set, but not 'Executable', NCCH is a CFA. Otherwise when 'Executable' is set, NCCH is a CXI.
bits 0-1: [[NCCH#Form_Type|Content Form Type]]
bits 2-7: [[NCCH#Content_Type|Content Type]]
|-
|-
|  6
|  6
Line 255: Line 289:
|  Bit-masks: FixedCryptoKey = 0x1, NoMountRomFs = 0x2, NoCrypto = 0x4, using a new keyY generator = 0x20(starting with FIRM [[9.6.0-24|9.6.0-X]]).
|  Bit-masks: FixedCryptoKey = 0x1, NoMountRomFs = 0x2, NoCrypto = 0x4, using a new keyY generator = 0x20(starting with FIRM [[9.6.0-24|9.6.0-X]]).
|}
|}
CXIs NCCH header signature is verified using the RSA public key stored in the accessdesc,(which follows the exheader) while CFAs NCCH header is verified with a fixed RSA public key.
CXIs NCCH header signature is verified using the RSA modulus stored in the exheader, while CFAs NCCH header is verified with a fixed RSA modulus. The public exponent is 65537 for both.
 
== Examples ==


==== NCCH header example for Lego Starwars III ====
=== NCCH header example for Lego Starwars III ===
  Signature:              720FF8F83F2A1E998322A026D1434165
  Signature:              720FF8F83F2A1E998322A026D1434165
                         ED19642ABC1CB2722135AA202BEAD60A
                         ED19642ABC1CB2722135AA202BEAD60A
Line 300: Line 336:
  Note: Offsets and sizes in media units have been converted to byte sizes.
  Note: Offsets and sizes in media units have been converted to byte sizes.


==== Plain region example for Lego Starwars III ====
=== Plain region example for Lego Starwars III ===
  0004a00: 5b 53 44 4b 2b 4e 49 4e 54 45 4e 44 4f 3a 43 54  [SDK+NINTENDO:CT    [SDK+NINTENDO:CTR_SDK-0_14_23_200_none]
  0004a00: 5b 53 44 4b 2b 4e 49 4e 54 45 4e 44 4f 3a 43 54  [SDK+NINTENDO:CT    [SDK+NINTENDO:CTR_SDK-0_14_23_200_none]
  0004a10: 52 5f 53 44 4b 2d 30 5f 31 34 5f 32 33 5f 32 30  R_SDK-0_14_23_20
  0004a10: 52 5f 53 44 4b 2d 30 5f 31 34 5f 32 33 5f 32 30  R_SDK-0_14_23_20
Line 317: Line 353:
  0004ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0004ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................


==== Example dependency list from the extended header ====
=== Example dependency list from the extended header ===
  00850 41 50 54 3A 55 00 00 00 24 68 69 6F 46 49 4F 00 APT:U...$hioFIO.
  00850 41 50 54 3A 55 00 00 00 24 68 69 6F 46 49 4F 00 APT:U...$hioFIO.
  00860 24 68 6F 73 74 69 6F 30 24 68 6F 73 74 69 6F 31 $hostio0$hostio1
  00860 24 68 6F 73 74 69 6F 30 24 68 6F 73 74 69 6F 31 $hostio0$hostio1