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

[Request] Add Decryption/Re-ecryption options #75

Open
SamRohod opened this issue Jan 10, 2021 · 3 comments
Open

[Request] Add Decryption/Re-ecryption options #75

SamRohod opened this issue Jan 10, 2021 · 3 comments

Comments

@SamRohod
Copy link

SamRohod commented Jan 10, 2021

Hello ihaveamac

Given your obvious knowledge about the 3DS formats, I thought that you are probably the right person to ask.
When it comes to .cia files, I haven't found a tool that could decrypt them to match no-intro database, and I haven't found any tool to re-encrypt them at all. My understanding is that the No-Intro database for encrypted and decrypted 3DS files is based on the tool "GodMod9" which can only be used on the 3DS right now.
Giving that at this point in time we have ways to access the 3DS keys/bootroms/seeddb.bin, can we compile the GodMode9 encryptor/decryptor/converter to run on PC ? Can you add it to NINFS ?

Some of the tools I found:-

NDecrypt:
Decrypts/re-encrypts .3ds files matching no-intro database
Doesn't support .cia files
Also decrypts/re-encrypts DS and DSi files

3DS + CIA Rom Script:
Decrypts/re-encrypts .3ds files matching no-intro database
Decrypts .cia files but not matching no-intro database & can't re-encrypt them

Batch CIA 3DS Decryptor:
Decrypts .3ds/.cia files but not matching no-intro database & can't re-encrypt either

@ihaveamac
Copy link
Owner

My understanding is that the No-Intro database for encrypted and decrypted 3DS files is based on the tool "GodMod9" which can only be used on the 3DS right now.

How do you know that? As far as I know the No-Intro database has existed long before GodMode9.

Giving that at this point in time we have ways to access the 3DS keys/bootroms/seeddb.bin, can we compile the GodMode9 encryptor/decryptor/converter to run on PC ? Can you add it to NINFS ?

GodMode9 is exclusively a 3DS application, it uses 3DS-specific hardware and APIs. But it can be replicated on PC and ninfs is probably the closest equivalent to it.

Neither tool decrypts it 100% cleanly though. In particular for any title using extra crypto (7x, 9.3, 9.6), the ExeFS has a bit of garbage in the unused space of the last block of the .code, due to how the encryption works. This doesn't affect functionality since it is unused space, but it means hashes that expect 100% perfect decryption will not match. It is something that can be fixed by hand though since the garbage just needs to be replaced with null bytes.

Re-encryption is not something I felt needed doing, but could be done if it's really desired.

@ihaveamac
Copy link
Owner

Neither tool decrypts it 100% cleanly though. In particular for any title using extra crypto (7x, 9.3, 9.6), the ExeFS has a bit of garbage in the unused space of the last block of the .code, due to how the encryption works. This doesn't affect functionality since it is unused space, but it means hashes that expect 100% perfect decryption will not match. It is something that can be fixed by hand though since the garbage just needs to be replaced with null bytes.

This part will be fixed once a new pyctr release with this change is implemented: ihaveamac/pyctr#10

@SamRohod
Copy link
Author

SamRohod commented Apr 1, 2022

Sorry for the bother but any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants