CIA: Difference between revisions
Link00000000 (talk | contribs) m Add clarification for what TMD is |
|||
(32 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
[[Category:File formats]] | [[Category:File formats]] | ||
== Overview == | == Overview == | ||
CIA stands for '''C'''TR '''I'''mportable '''A'''rchive. This format allows the installation titles to the 3DS. CIA files | CIA stands for '''C'''TR '''I'''mportable '''A'''rchive. This format allows the installation of titles to the 3DS. CIA files and titles on [[Title list|Nintendo's CDN]] contain identical data. As a consequence, valid CIA files can be generated from CDN content. This also means CIA files can contain anything that titles on Nintendo's CDN can contain. | ||
Under normal circumstances CIA files are used where downloading a title is impractical or not possible. Such as distributing a [[Download Play]] child, or installing forced Gamecard updates. Those CIA(s) are stored by the titles in question, in an auxiliary [[NCCH#CFA|CFA]] file. | |||
[[Download Play]] child | |||
Development Units, are capable of manually installing CIA files via the [[3DS Development Unit Software#Dev Menu|Dev Menu]]. | Development Units, are capable of manually installing CIA files via the [[3DS Development Unit Software#Dev Menu|Dev Menu]]. | ||
== Format == | == Format == | ||
This is the current version of the CIA format, it was finalised in late 2010. (Older versions of the CIA format can be viewed on the [[Talk:CIA|Talk]] page) | |||
The CIA format has a similar structure to the [http://wiibrew.org/wiki/Wad WAD format]. | The CIA format has a similar structure to the [http://wiibrew.org/wiki/Wad WAD format]. | ||
Line 15: | Line 16: | ||
The data is aligned in 64 byte blocks (if a content ends at the middle of the block, the next content will begin from a new block). | The data is aligned in 64 byte blocks (if a content ends at the middle of the block, the next content will begin from a new block). | ||
=== CIA Header === | === CIA Header === | ||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
Line 30: | Line 27: | ||
| 0x00 | | 0x00 | ||
| 0x04 | | 0x04 | ||
| Archive Header Size (=0x2020 bytes | | Archive Header Size (Usually = 0x2020 bytes) | ||
|- | |- | ||
| 0x04 | | 0x04 | ||
Line 46: | Line 43: | ||
| 0x0C | | 0x0C | ||
| 0x04 | | 0x04 | ||
| Ticket size | | [[Ticket]] size | ||
|- | |- | ||
| 0x10 | | 0x10 | ||
| 0x04 | | 0x04 | ||
| [[TMD]] file size | | [[TMD]] (Title Metadata) file size | ||
|- | |- | ||
| 0x14 | | 0x14 | ||
Line 57: | Line 54: | ||
|- | |- | ||
| 0x18 | | 0x18 | ||
| | | 0x08 | ||
| | | Content size | ||
|- | |- | ||
| | | 0x20 | ||
| | | 0x2000 | ||
| | | Content Index | ||
|} | |} | ||
Line 69: | Line 66: | ||
* Ticket | * Ticket | ||
* TMD file data | * TMD file data | ||
* | * Content file data | ||
* Meta file data | * Meta file data (Not a necessary component) | ||
The contents (NCCH/SRL) are encrypted using 128-bit AES-CBC. The encryption uses the decrypted titlekey from the [[Ticket#Structure|ticket]], and the content index from the TMD padded with zeros as the IV. | |||
=== Certificate Chain === | |||
There are three [[Certificates|certificates]] in this chain: | |||
{| class="wikitable" border="1" | |||
|- | |||
! CERTIFICATE | |||
! SIGNATURE TYPE | |||
! RETAIL CERT NAME | |||
! DEBUG CERT NAME | |||
! DESCRIPTION | |||
|- | |||
| CA | |||
| RSA-4096 | |||
| CA00000003 | |||
| CA00000004 | |||
| Used to verify the Ticket/TMD Certificates | |||
|- | |||
| Ticket | |||
| RSA-2048 | |||
| XS0000000c | |||
| XS00000009 | |||
| Used to verify the Ticket signature | |||
|- | |||
| TMD | |||
| RSA-2048 | |||
| CP0000000b | |||
| CP0000000a | |||
| Used to verify the TMD signature | |||
|} | |||
The | The CA certificate is issued by 'Root', the public key for which is stored in NATIVE_FIRM. | ||
=== Meta === | === Meta === | ||
Line 86: | Line 116: | ||
| 0x00 | | 0x00 | ||
| 0x180 | | 0x180 | ||
| Title ID dependency list - Taken from the application's [[NCCH | | Title ID dependency list - Taken from the application's [[NCCH/Extended Header|ExHeader]] | ||
|- | |- | ||
| 0x180 | | 0x180 | ||
| | | 0x180 | ||
| Reserved | | Reserved | ||
|- | |||
| 0x300 | |||
| 0x4 | |||
| Core Version | |||
|- | |||
| 0x304 | |||
| 0xFC | |||
| Reserved | |||
|- | |- | ||
| 0x400 | | 0x400 | ||
Line 102: | Line 140: | ||
* [https://github.com/3dshax/ctr/tree/master/ctrtool ctrtool] - Reading/Extraction of CIA files. This can only decrypt the title-key for development CIAs, since retail CIAs use the [[AES]] hardware key-scrambler for the common-key keyslot. | * [https://github.com/3dshax/ctr/tree/master/ctrtool ctrtool] - Reading/Extraction of CIA files. This can only decrypt the title-key for development CIAs, since retail CIAs use the [[AES]] hardware key-scrambler for the common-key keyslot. | ||
* [https://github.com/Tiger21820/ctr_toolkit/tree/master/make_cia make_cia] - Generating CIA files. Requires CommonKey and ticket/TMD RSA-2048 private exponents. | |||
* [https://github.com/Tiger21820/ctr_toolkit/tree/master/make_cdn_cia make_cdn_cia] - (CMD)(Windows/Linux) Generates CIA files from CDN Content | |||
* [[makerom]] - Tool which can be used to create NCCH, CCI, and CIA files. | |||
== Title Key Encryption == | == Title Key Encryption == |