Atmosphere-NX / hac2l

hac2l is a tool to view information about, decrypt, and extract common file formats for the Nintendo Switch, especially Nintendo Content Archives.
GNU General Public License v2.0
50 stars 4 forks source link

Unable to use title id file #3

Closed mrdude2478 closed 2 weeks ago

mrdude2478 commented 2 weeks ago

Hi maybe I am doing something wrong, but I can't seem to extract using an nsp if it's encoded with a tik.

Here's whatI am doing:

Extract nca files:
==========
hac2l -k keys.txt -t nsp pipe.nsp --outdir NCA_files

Create a textfile with the tik
==================
tf NCA_files/0100ab0017bea000000000000000000d.tik >> tik.txt

Make directory to extact in
==================
mkdir EXTRTD_NSP

Next - try to extract the NCA
==================
hac2l -k keys.txt --titlekeys=tik.txt -t nca --section0dir=EXTRTD_NSP\temp --section1dir=EXTRTD_NSP\romfs --section2dir=EXTRTD_NSP\logo --section3dir=EXTRTD_NSP\control NCA_files/aea30f0b44257c7a45b9e8cff7e5489b.nca >EXTRTD_NSP\info.txt

Errors occured:
=========
) inside key file (C:/Users/MrDude/Desktop/New Binaries/tik.txt)c39bda [Warning]: Failed to find titlekey for rights id 0100AB0017BEA000000000000000000D [Warning]: Failed to open NCA section 0: 2002-4535, NCA may be corrupt. [Warning]: Failed to mount NCA section 1 as RomFsFileSystem: 2002-4604

Note:
===
Inside the tik.txt file there's only one line which contains the correct tik, basically just a single line like this - (this is a made up number)

011C05C20822EE252C08EEAC0C380000

Am I doing something wrong, or is there an issue reading from text files? There's no option that I can find to manually add the tik unless it's in a file.

SciresM commented 2 weeks ago

Well, that is in fact the wrong format for a titlekeys file for hac2l (it should be rights_id = titlekey) for all rights/titles.

However, why are you...extracting everything?

hac2l supports recursive parsing.

If you want the exefs and romfs, you can just do hac2l -t nsp whatever.nsp --exefsdir=exefs --romfsdir=romfs and this "should" work I think?

mrdude2478 commented 2 weeks ago

Thanks, that worked fine.

I couldn't find any information anywhere that you needed to put "rights_id = " before the key in the text file. Also it's good you don't need to extract the nca files :-).

SciresM commented 2 weeks ago

The rights_id needs to be whatever the actual rights_id is for the titlekey. As your error message says, the rights for the title you care about is 0100AB0017BEA000000000000000000D

So title.keys would contain e.g. 0100AB0017BEA000000000000000000D = <key goes here>

mrdude2478 commented 2 weeks ago

The rights_id needs to be whatever the actual rights_id is for the titlekey. As your error message says, the rights for the title you care about is 0100AB0017BEA000000000000000000D

So title.keys would contain e.g. 0100AB0017BEA000000000000000000D = <key goes here>

That's weird, because I just tried with this inside the text file: "rights_id = 011C05C20822EE252C08EEAC0C38FXXX"

It extracted everything I wanted, however Also doing it the way you said also works.