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

Content to CIA creates bad CIA file when creating SEED-encrypted titles #107

Closed
MelonGx opened this issue Oct 29, 2016 · 14 comments
Closed

Comments

@MelonGx
Copy link

MelonGx commented Oct 29, 2016

Devmenu/FBI reported it that "This CIA is invalid".
Converting No-SEED titles is fine.

(Edited at 2016-11-02)
Rebuilt the CIA with 2016-10-21 release.
It can be installed properly.
So the "This CIA is invalid" case seems to be simply a file error.

But after the installation, there is one more SEED related problem occurs.
See the following comments for details.

@MelonGx
Copy link
Author

MelonGx commented Oct 29, 2016

I know that we still have the old method to convert a SEED title into proper CIA.
But if Content to CIA can be fixed for this, it will be much easier.

The workable SD to CIA with SEED decrypted I used to use is

  1. Dump decrypted *.tmd and *.app with SD Decryptor
  2. Convert *.tmd and *.app into *.3DS with SDto3DS.py on PC
  3. Decrypt *.3DS with NCCH/NCSD Decryptor (this decrypts SEED)
  4. Convert *.3DS into *.CIA with NCCH/NCSD to CIA Converter
    It takes 4 steps and requires a PC.

@d0k3
Copy link
Owner

d0k3 commented Oct 30, 2016

I'll look into it, but there is something you can try. Open the CIA in a hex editor (GM9 f.e.) and zero out the four byte at 0x14. Then try installing it again.

... and second thing you can try. Decrypt the CIA via the CIA decryptor (deep). If there are any errors, give me the output from the log. Then try to install again.

.. and the third thing to try. Make 100% sure this has to do with seed crypto and not with that specific title. It is rather unlikely seed crypto is any problem in that function.

@d0k3
Copy link
Owner

d0k3 commented Oct 30, 2016

Okay, I tried it myself. This has nothing to do with seed crypto cause other seed titles work. Can you give me the title this happened with? Was it the Sun & Moon demo?

Also, please test the stuff I described above.

EDIT (yeah, edits, edits): also please retry with the most recent release of D9 of you haven't yet.

EDIT2 (last one, hopefully): Even the SM demo works without trouble. Can you tell me if you tried that CIA on the same console it came from?

@d0k3
Copy link
Owner

d0k3 commented Nov 1, 2016

And here's a test build you can try:
https://transfer.sh/KamnL/decrypt9wip-20161101-141552.zip
This one should work 100%. Once you're ready, let me know how that works for you.

@MelonGx
Copy link
Author

MelonGx commented Nov 2, 2016

Thanks. I'm now dumping that title again with the test build.
The title was 00040000001af500.
The error happened on installing the CIA on another 3DS which hadn't installed that title before.
Here is the log of this time's dumping

@MelonGx
Copy link
Author

MelonGx commented Nov 2, 2016

The CIA built from the test build is installable now.
I'll try to build the CIA with 2016-10-21 release and test it again later.

(Edit)
Even the CIA built from test build is installable, it stucks at Nintendo 3DS screen.
(I always test with a console/NAND which hasn't installed that title before.)
If opening Luma's ErrDisp function, it shows this after 0.5sec of the Nintendo 3DS screen.
img_2252
This looks pretty like the symptom of SEED isn't properly decrypted.

(Edit2)
Confirmed that this is a SEED-not-decrypted issue.
Because after I go to the game page in the e-shop (this action downloads the game's SEED), it becomes available to run the game.

(Edit3)
CIA rebuilt with 2016-10-21 release is installable now.
Seems that the error case from the topic is simply a file error.
But of course, it also has the Edit & Edit2's problem.

@d0k3
Copy link
Owner

d0k3 commented Nov 2, 2016

Alright, thanks! The SD -> CIA converter tries to build CIAs that are as original as possible. For installed legit CIAs f.e., you will again get a legit CIA back after rebuilding. This also means that any crypto the installable content has (SEED / regular / 7x / Secure3 / Secure4) is kept (actually must be kept to keep the sigs intact).

You can fix this by running CIA decryptor (deep) after the conversion. Question now is, shouldn't that be handled by the SD -> CIA Converter itself, right? Tbh, I am unsure about that.

@MelonGx
Copy link
Author

MelonGx commented Nov 2, 2016

OK I'll try the SD to CIA -> CIA Decryptor (deep) to see whether it works or not.
BTW SD to CIA -> CIA Decryptor (shallow) results a "This CIA is invalid" and I don't know why, since this time it's not a file copy error.

@d0k3
Copy link
Owner

d0k3 commented Nov 3, 2016

That could actually only happen if the SEED in your seeddb.bin is invalid. In that case, though, the SD to CIA decryptor would throw an error, too. Did it?

@MelonGx
Copy link
Author

MelonGx commented Nov 3, 2016

Tried that SD to CIA -> CIA Decryptor (deep) works without any "CIA invalid" issue.
It's OK now.

@MelonGx
Copy link
Author

MelonGx commented Nov 3, 2016

The shallow decryption's process was succeeded but the output CIA by shallow got the CIA invalid issue.
The SEED was already imported into seeddb.bin.
So I don't know why shallow didn't work.

@MelonGx MelonGx closed this as completed Nov 3, 2016
@d0k3
Copy link
Owner

d0k3 commented Nov 3, 2016

Just to clarify this... Are you trying to install this CIA on GW? If so, known GW issue (incomplete / improper sig patching). Otherwise I'd need to find out what's wrong with deep decryption.

@d0k3 d0k3 reopened this Nov 3, 2016
@MelonGx
Copy link
Author

MelonGx commented Nov 4, 2016

Deep decryption's output CIA is fine.
Shallow decryption's output CIA isn't.
It happened on Luma 6.3.1.

@MelonGx
Copy link
Author

MelonGx commented Nov 8, 2016

Since

  1. SD to CIA
  2. CIA Decryptor (Deep)
    works,
    no matter whether CIA Decryptor (Shallow) works or not, this issue is resolved.

@MelonGx MelonGx closed this as completed Nov 8, 2016
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