Closed ZeroSkill1 closed 2 years ago
I'm not sure I completely understand the scenario where CTRTool is having trouble.
You have a CIA file where the CIA layer of encryption is supposed to be present but isn't?
If that is the issue, try this build (pick whatever platform you use):
You have a CIA file where the CIA layer of encryption is supposed to be present but isn't?
No, that is not the issue.
You take a CIA with CIA-layer encryption and pass it to ctrtool with the -p
flag, even without --contents
.
The following is output:
|- HeaderSize: 0x2020
|- Type: Normal (0x0000)
|- FormatVersion: Cia (0x0000)
|- CertificateSize: 0xa00
|- TicketSize: 0x350
|- TitleMetaSize: 0xb64
|- FooterSize: 0x3ac0
|- ContentSize: 0x5eea000
\- EnabledContent:
|- 0x0000
\- 0x0001
Certificate Chain:
|- Certificate 0:
| |- DigitalSignature:
| | |- SigType: RSA-4096-SHA256 (0x10003)
| | |- Issuer: Root
| | \- Signature: 704138EF...61CB4C2E
| |- Subject: CA00000003
| \- PublicKey: RSA-2048 (0x1)
| |- m: B279C9E2...EBEED379
| \- e: 00010001
|- Certificate 1:
| |- DigitalSignature:
| | |- SigType: RSA-2048-SHA256 (0x10004)
| | |- Issuer: Root-CA00000003
| | \- Signature: 2EA66C66...D426560C
| |- Subject: CP0000000b
| \- PublicKey: RSA-2048 (0x1)
| |- m: A689C590...6DA3772B
| \- e: 00010001
\- Certificate 2:
|- DigitalSignature:
| |- SigType: RSA-2048-SHA256 (0x10004)
| |- Issuer: Root-CA00000003
| \- Signature: 919EBE46...08847982
|- Subject: XS0000000c
\- PublicKey: RSA-2048 (0x1)
|- m: AD505BB6...34652625
\- e: 00010001
Ticket:
|- DigitalSignature:
| |- SigType: RSA-2048-SHA256 (0x10004)
| |- Issuer: Root-CA00000003-XS0000000c
| \- Signature: 130EC1E6...7CCBCE39
|- TitleKey: 44CE1A518D0FDE794C2CB3D8576C725F (decrypted: 284C5FF23792291A2C038FDF286981AD)
|- TicketId: 0004ad0404f24b76
|- DeviceId: 00000000
|- TitleId: 0004000e00022800
|- TicketVersion: 14.7.0 (14448)
|- LicenseType: 00
|- KeyId: 00
|- ECAccountID: 00000000
|- DemoLaunchCnt: 0
\- EnabledContent:
|- 0x0000
\- 0x0001
TitleMetaData:
|- DigitalSignature:
| |- SigType: RSA-2048-SHA256 (0x10004)
| |- Issuer: Root-CA00000003-CP0000000b
| \- Signature: 0E4D065C...461C7379
|- TitleId: 0004000e00022800
|- TitleVersion: 14.7.0 (14448)
|- CustomData:
| |- SaveDataSize: 0x0
| \- IsSnakeOnly: false
\- ContentInfo:
|- 0x0000:
| |- ContentId: 0x00000008
| |- Encrypted: YES
| |- Optional: NO
| |- Size: 0x5d6a000
| \- Hash: 0121A1E5944586070EBD7A6932BD7138C6ABFA6012A8C19096CCBDDE41320735
\- 0x0001:
|- ContentId: 0x00000009
|- Encrypted: YES
|- Optional: NO
|- Size: 0x180000
\- Hash: 922C862B4E188C2DFCE605E5A2307741252F0464F5A1162F43097583D7BE3E6B
NCCH:
Header: NCCH
Signature: 2FD3B4647AE4F910F925D0267A2A222D33562172531BBA10C526A302C7A870F2
A8F26697C328C8AB50E20D135E02CA46D7B5F0ADD64440CF2DEB2AD91EA609A5
A6E70CDC1F813D81F19DCE260B6445E51A31D22428B105C6419A265AB746996A
0122F69C02D1663F7D482AE6A5A4DB3AAEDF9E9B57B8BD768D5EF03C318A5535
3D7E4ADA38291FCD06803DF1279916D07B5E78D5DDEFB607F5DB0F974B613132
B63AA721DDC8AD94BF1D260A90EF7810EF9B1691A166AB69378BE434A8306571
CE1C01EEC127DA3147493C04F70BB7F76556F2FA669C95675475B31B8EC96AD7
3912EB74A6EE1FF7281FBFA2F3994985C53B2DBC46DB09D94EDF13DC709A7C63
Content size: 0x05d6a000
Title id: 0004000e00022800
Maker code: 01
FormatVersion: 2
Title seed check: 00000000
Program id: 0004000e00022800
Logo hash: 2A98C49D919E254E15DC213CAB47A800ED63B248DCD43119E8FB82D9E62AE51C
Product code: CTR-U-HMEP
Exheader size: 0x400
Exheader hash: C82D97657CE081FB0650F3248E713197E41C2758EBB3115C351DBF1437F64395
Flags: 0000000101030000
> Crypto Key Secure (1)
> ContentPlatorm: CTR
> FormType: Executable
> ContentType: Application
> BlockSize: 0x200
Plain region offset: 0x00002a00
Plain region size: 0x00000200
Logo offset: 0x00000a00
Logo size: 0x00002000
ExeFS offset: 0x00002c00
ExeFS size: 0x00825800
ExeFS hash region size: 0x00000200
RomFS offset: 0x00829000
RomFS size: 0x05541000
RomFS hash region size: 0x00000200
ExeFS hash: 73AF4E4B80C1060721A377FDE26515D33AE818968EDC096E95F29256E7B6C18B
RomFS hash: 87237E7622F433CFE0CB915053CA63137EA808509477AEA47E5DF423D3622174
Extended header:
Signature: BDBEC0FED7B665C0664E313B95ACAED39B48562B347241A4037F0934CB941606
C9A51E6A10D3D504594E2D7135A0F7D850D50C41AC4ECE8CB0182E32E8D3B579
5A5B673418EB874A29A4B434C12B82B8865042701DF32CB641C82949D2778B17
2D75F009E92A03B9356C5E65A2D34C32C9ED8B80823869959FB7517054804C85
5C817BD431118E1E5C6D7B1D0DFE2DEA57147198BDFA8E67C7BA46121C0B13B9
4072286AD3F80C382209BF67A35D36DE11E5C5A0BDC702672A79C6ACC652B2A1
1A3E03B85570A9514F4A96A6ACD4CF876994E9EE3A7C8017ACDABDC61F7CA5A2
9283C8043F197654E11BAA758E9440E5359629BB1C9D97BBE5AEE6ADAF140EFC
NCCH Hdr RSA Modulus: 3DDEA2545DD493B8D0682061E3E75C109540D0BA453EA0E9619A62292A43D5FC
75AD8D67506C4197E9BFE0413BD303499B5E508FD9E3005E32816431A0B62289
924A75266FBC57BD63D4046BF5D37A5DB376C333C68F42A14696FEA676F138CD
A6064A38A725F838EBF9FA05450470D62D9DF488D75D0A3BCBFF72F6CE4F3187
056C84E5045C8950D8F70D52F4771B3B3DC9A817ED8634679867791057206215
FA3B02614C3AB2BF020838754E303A3645D23F24A95792D8563A9E07A487A5A5
ABB0D1F7F12D7684A2B2F7C18EBF80BAFDDBD2BFD0FA351E714DAA2D361FC64B
241F33D45EB98130176D44A74F19633569534464AD07B367BB3E0B9AB5EE76C7
Name: 7�N�S�rD
Flags: 03 [compressed] [sd app]
Remaster version: b1be
Code text address: 0xBC51785C
Code text size: 0x1B4136F1
Code text max pages: 0x33F0A30A (0x0A30A000)
Code ro address: 0xC4A7E1F8
Code ro size: 0xFB6A3200
Code ro max pages: 0xDAA96718 (0x96718000)
Code data address: 0xA31C97CE
Code data size: 0xEBCE1268
Code data max pages: 0x715417F1 (0x417F1000)
Code bss size: 0x038FC1FE
Code stack size: 0x74A80C2F
Dependency: 94c45c5363aa02a8
Dependency: 55857f086ebccc38
Dependency: c2b01120e8aac6d8
Dependency: 3d2f78b18d8deb06
Dependency: 741f46a4a0bcffbf
Dependency: b0a46f01ec658468
Dependency: db6dadac7cd14f49
Dependency: b636f07092cf68ba
Dependency: 67ef292bdda9c791
Dependency: e13dac84acfdd21d
Dependency: 317eb161bc8d425e
Dependency: 5b63de631a43c4bb
Dependency: 6d2401347a4a58ca
Dependency: 1cf81a6e0c510fcd
Dependency: 101eb6c71d4b5aac
Dependency: e1e591417b607f0a
Dependency: fd7a84343a558d27
Dependency: 6ff23d1fd5cdee05
Dependency: 4bc6de89c4ee24ae
Dependency: c102aad9349302b6
Dependency: bb42306bd4fbe4e6
Dependency: 53ddf6d519a72e0f
Dependency: 246cc6a6871fb19c
Dependency: 93302d0e160d9e96
Dependency: 1b6beebae1f6e466
Dependency: 95349bb3d8972d8b
Dependency: 5172df1c76704d35
Dependency: 4b5fad5d1c20bed7
Dependency: 37b8210785ea946d
Dependency: 5fa7d6905e35ce5f
Dependency: 2c4aa4bcbd9136bb
Dependency: 9c99f16c62e783b3
Dependency: 315befa097a16ee4
Dependency: 9c08cf5b494737d8
Dependency: 2e6cac7a0fcdff0b
Dependency: 29c95ea55026f64f
Dependency: 914b2cc559e531c2
Dependency: 27389dbdd9cfe150
Dependency: 7cd5c34ef5efd910
Dependency: e7457dd4452ee714
Dependency: cf85d9d68b71ef03
Dependency: 73e993d3c70460d2
Dependency: 3ee4c15853699221
Dependency: c0758856ed8d7c99
Dependency: 13706206a2e3c8cc
Dependency: b9f21076f404436d
Dependency: e92d74462a9238ab
Dependency: 4bb7bf34ee0b688f
Savedata size: 7489307803842M
Jump id: 88c552273424cae9
Program id: 190d50f1e9300b6e
Core version: 0xf3e77841
System mode: Unknown (0xb) (AppMemory: Unknown)
System mode (New3DS): Unknown (0x8) (AppMemory: Unknown)
CPU Speed (New3DS): 804MHz
Enable L2 Cache: YES
Ideal processor: 3
Affinity mask: 3
Main thread priority: 87
MaxCpu: 52508
Ext savedata id: 0x7c5e67f3a988695b
System savedata id 1: 0xebccb839
System savedata id 2: 0x9fd27b61
OtherUserSaveDataId1: 0x34db5
OtherUserSaveDataId2: 0x315aa
OtherUserSaveDataId3: 0x6a32c
Accessible Savedata Ids: None
Other Variation Saves: Accessible
FS access: 0xa3c3afec8c3e19
> Category System Application
> Debug
> TWL Card Backup
> CTR NAND RO
> CTR NAND RW
> CTR NAND RO (Write Access)
> Category System Settings
> CARD BOARD
> Shop
> Shell
> Bit 23 (unknown)
> Bit 26 (unknown)
> Bit 27 (unknown)
> Bit 29 (unknown)
> Bit 30 (unknown)
> Bit 31 (unknown)
> Bit 32 (unknown)
> Bit 33 (unknown)
> Bit 34 (unknown)
> Bit 35 (unknown)
> Bit 37 (unknown)
> Bit 39 (unknown)
> Bit 40 (unknown)
> Bit 41 (unknown)
> Bit 46 (unknown)
> Bit 47 (unknown)
> Bit 48 (unknown)
> Bit 49 (unknown)
> Bit 53 (unknown)
> Bit 55 (unknown)
Service access:
> �QD�&Pm
> o���z��L
> 9#�Ѭ-�s
> �Z>�7��
> �1�9j��U
> � ��+٠;
> �������
> ���.�Pc�
Culn].
> ���T��(�
> ��2�j
> �SI��N�
> ��GC"E�
> ��U��{�1
> "��N
o��
> ���p��Ð
> ^Q�ɖ&�
> �~ө%
> ��A�̪SX
> ��\7�1�
> �J'�gb�
> �|.�� �
> �������
> T�N)V+
> ��e,D���
> \�-��%��
> >�ж LQ
> >�E�4�k�
> 4�~FM
> ]���{�
> ������
> {�h�WD�
> ���gP.X�
> F-�P$ |~
Reslimit category: D9
Allowed systemcalls: none
Allowed interrupts: 54, 34, 0C, 13
Unknown descriptor: 28C8E0B9
Unknown descriptor: 8636A3FC
Unknown descriptor: 52884F0E
Unknown descriptor: 5FB68AC2
Unknown descriptor: D5F22D8B
Unknown descriptor: 273AF028
Unknown descriptor: B53907A8
Unknown descriptor: 3CE78B02
Unknown descriptor: 087ABD10
Unknown descriptor: 4C44DE15
Unknown descriptor: 117176A1
Unknown descriptor: BDDB3424
Unknown descriptor: 7C21F4E3
Unknown descriptor: F93A5B2F
Unknown descriptor: 0FCD560C
Unknown descriptor: 4C41B020
Unknown descriptor: 2BBA9320
Unknown descriptor: 25485DCD
Unknown descriptor: FB036B91
Unknown descriptor: B7BDC47A
Unknown descriptor: AD3C0AE0
Unknown descriptor: 1C59CF19
Unknown descriptor: 4F8BD3B3
Unknown descriptor: 0E6057E0
Unknown descriptor: 6324C1DF
Unknown descriptor: 3180CD24
Unknown descriptor: AA924FED
Arm9Capability:
> FsMountNandRoWrite
> FsMountWnand
> FsMountCardSpi
> SdApplication
> Bit 10 (unknown)
> Bit 11 (unknown)
> Bit 12 (unknown)
> Bit 13 (unknown)
> Bit 14 (unknown)
> Bit 16 (unknown)
> Bit 20 (unknown)
> Bit 21 (unknown)
> Bit 23 (unknown)
> Bit 25 (unknown)
> Bit 27 (unknown)
> Bit 30 (unknown)
> Bit 31 (unknown)
> Bit 32 (unknown)
> Bit 36 (unknown)
> Bit 38 (unknown)
> Bit 43 (unknown)
> Bit 44 (unknown)
> Bit 46 (unknown)
> Bit 47 (unknown)
> Bit 49 (unknown)
> Bit 51 (unknown)
> Bit 52 (unknown)
> Bit 55 (unknown)
> Bit 56 (unknown)
> Bit 59 (unknown)
> Bit 61 (unknown)
> Bit 64 (unknown)
> Bit 65 (unknown)
> Bit 66 (unknown)
> Bit 68 (unknown)
> Bit 69 (unknown)
> Bit 70 (unknown)
> Bit 73 (unknown)
> Bit 76 (unknown)
> Bit 78 (unknown)
> Bit 79 (unknown)
> Bit 80 (unknown)
> Bit 83 (unknown)
> Bit 85 (unknown)
> Bit 86 (unknown)
> Bit 87 (unknown)
> Bit 88 (unknown)
> Bit 89 (unknown)
> Bit 91 (unknown)
> Bit 93 (unknown)
> Bit 95 (unknown)
> Bit 96 (unknown)
> Bit 98 (unknown)
> Bit 101 (unknown)
> Bit 106 (unknown)
> Bit 109 (unknown)
> Bit 116 (unknown)
> Bit 118 (unknown)
Desc Version: 0xf
[ctrtool::ExeFsProcess ERROR] ExeFsHeader is corrupted (Bad first entry).
The build you sent removes the garbled data output. However, it shows the following:
[ctrtool::NcchProcess ERROR] NcchHeader is corrupted (Bad struct magic).
This is a fully encrypted CIA using CDN-level encryption. The message should not appear and it should be aware of the encryption, so it should not try to show any more info than possible.
This is a fully encrypted CIA using CDN-level encryption.
Then you shouldn't be using the -p
flag. That's a feature to force CTRTool to not decrypt the file. If you use that flag on an encrypted file, CTRTool is going to trust that you've given it decrypted data.
The message should not appear and it should be aware of the encryption, so it should not try to show any more info than possible.
Following on from what I said above, using the -p
flag will force it to disregard encryption. Those errors, are what you see when CTRTool is expecting valid data, but doesn't get it.
CTRTool is a best-effort program, it will go as far as it safely can to process a file you give it based on the parameters. If you tell it to treat a file like it isn't encrypted, it will do just that.
Then you shouldn't use the
-p
flag.
If I don't, the extracted contents are decrypted. I use -p
to extract raw, fully encrypted contents. Previous versions of ctrtool did this just fine, though.
The latest release of CTRTool, honours the -p flag for CIA layer of encryption. So you should be able to extract the encrypted contents, as-is, just fine.
Issue stated in title. Extracting contents using
--contents={prefix}
still works, however garbage encrypted data and ExHeader warnings are shown. This is possible due to it expecting decrypted output, which is not actually decrypted due to-p
being passed by the user.