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

Can't extract NCA file from .nca folder #90

Open
Real96 opened this issue Apr 21, 2020 · 8 comments
Open

Can't extract NCA file from .nca folder #90

Real96 opened this issue Apr 21, 2020 · 8 comments

Comments

@Real96
Copy link

Real96 commented Apr 21, 2020

I'm trying to extract a nca update file from a .nca folder with a single 00 file inside (it is Pokémon Sword update). I downloaded last hactool.exe release and used this command:

hactool -k foldername/prod.keys -t nax0 --sdseed=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --sdpath="/foldername/folder.nca" --plaintext=game.nca "D:/foldername/folder.nca/00"

prod.keys file is inside the correct folder, i extracted it using Lockpick_RCM. Changed the Xs with sd_seed found inside prod.keys file. I'm getting this (i removed the values between the ""):

[WARN] prod.keys does not exist.
[WARN]: Failed to match key "bis_kek_source", (value "")
[WARN]: Failed to match key "bis_key_00", (value "")
[WARN]: Failed to match key "bis_key_01", (value "")
[WARN]: Failed to match key "bis_key_02", (value "")
[WARN]: Failed to match key "bis_key_03", (value "")
[WARN]: Failed to match key "bis_key_source_00", (value "")
[WARN]: Failed to match key "bis_key_source_01", (value "")
[WARN]: Failed to match key "bis_key_source_02", (value "")
[WARN]: Failed to match key "device_key", (value "")
[WARN]: Failed to match key "device_key_4x", (value "")
[WARN]: Failed to match key "eticket_rsa_kek", (value "")
[WARN]: Failed to match key "eticket_rsa_kek_source", (value "")
[WARN]: Failed to match key "eticket_rsa_kekek_source", (value "")
[WARN]: Failed to match key "retail_specific_aes_key_source", (value "")
[WARN]: Failed to match key "rsa_oaep_kek_generation_source", (value "")
[WARN]: Failed to match key "rsa_private_kek_generation_source", (value "")
[WARN]: Failed to match key "save_mac_key", (value "")
[WARN]: Failed to match key "save_mac_sd_card_kek_source", (value "")
[WARN]: Failed to match key "save_mac_sd_card_key_source", (value "")
[WARN]: Failed to match key "sd_card_custom_storage_key_source", (value "")
[WARN]: Failed to match key "sd_seed", (value "")
[WARN]: Failed to match key "ssl_rsa_kek", (value "")
[WARN]: Failed to match key "ssl_rsa_kek_source_x", (value "")
[WARN]: Failed to match key "ssl_rsa_kek_source_y", (value "")
Error: File has invalid NAX0 magic!
Done!

What is the problem?

@shchmue
Copy link
Collaborator

shchmue commented Apr 21, 2020

That’s not a nax0 that’s an nca.

@shchmue
Copy link
Collaborator

shchmue commented Apr 21, 2020

oh, nuts, it should be a nax0 after all if it's content on SD. i guess try -t nca? the nax0 magic is not encrypted.

@Real96
Copy link
Author

Real96 commented Apr 21, 2020

Ok i used the same command i wrote before with -t nca. It worked but gave me this at the end:

`BKTR section seems to be corrupted.

Error: section 0 is corrupted!

Note: cannot save BKTR section without base romfs.

Saving Decrypted NCA to game.nca...
Done!`

Is this ok? Or do i need the romfs?

@shchmue
Copy link
Collaborator

shchmue commented Apr 21, 2020

up to you, you do indeed need to provide the base title to extract romfs

@Real96
Copy link
Author

Real96 commented Apr 21, 2020

I gave it the romfs but still gives me always the same ending corruption error...i added --romfs=romfs.bin near -t nca (i extracted the romfs.bin from the dumped xci)

@Real96
Copy link
Author

Real96 commented Apr 22, 2020

Anyway it isn't an SD content, the file is inside the USER partition. Both Pokemon Sword and Shield updates are inside the USER partition

@ToasterDEV
Copy link

Hey there!

I'm having the same issue.

After building hactool from source on Ubuntu 20.10 on a WSL2 host and providing the following command:

hactool -t nax0 --sdseed="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 
--sdpath="/registered/00000000/6b37623b1b74cc73e13d1a13c0bb87d0.nca"
--plaintext 00000000.nca "/mnt/c/Users/ToasterDEV/OneDrive/Desktop/Nintendo/Contents/registered/00000000/6b37623b1b74cc73e13d1a13c0bb87d0.nca/00"

I receive the following output (prod.keys has been extracted from my Switch and stored within Ubuntu in "~/.switch/prod.keys"):

[WARN]: Failed to match key "bis_kek_source", (value "")
[WARN]: Failed to match key "bis_key_00", (value "")
[WARN]: Failed to match key "bis_key_01", (value "")
[WARN]: Failed to match key "bis_key_02", (value "")
[WARN]: Failed to match key "bis_key_03", (value "")
[WARN]: Failed to match key "bis_key_source_00", (value "")
[WARN]: Failed to match key "bis_key_source_01", (value "")
[WARN]: Failed to match key "bis_key_source_02", (value "")
[WARN]: Failed to match key "device_key", (value "")
[WARN]: Failed to match key "device_key_4x", (value "")
[WARN]: Failed to match key "retail_specific_aes_key_source", (value "")
[WARN]: Failed to match key "rsa_oaep_kek_generation_source", (value "")
[WARN]: Failed to match key "rsa_private_kek_generation_source", (value "")
Error: NAX0 key derivation failed. Check SD card seed and relative path?
Done!

(The value of the reys was manually removed by me when copying the output over.

Trying the same command but with "-t nca" ( hactool -t nca --sdseed="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " --sdpath="/registered/00000000/6b37623b1b74cc73e13d1a13c0bb87d0.nca" --plaintext 00000000.nca "/mnt/c/Users/ToasterDEV/OneDrive/Desktop/Nintendo/Contents/registered/00000000/6b37623b1b74cc73e13d1a13c0bb87d0.nca/00" ) produces the following output:

[WARN]: Failed to match key "bis_kek_source", (value "")
[WARN]: Failed to match key "bis_key_00", (value "")
[WARN]: Failed to match key "bis_key_01", (value "")
[WARN]: Failed to match key "bis_key_02", (value "")
[WARN]: Failed to match key "bis_key_03", (value "")
[WARN]: Failed to match key "bis_key_source_00", (value "")
[WARN]: Failed to match key "bis_key_source_01", (value "")
[WARN]: Failed to match key "bis_key_source_02", (value "")
[WARN]: Failed to match key "device_key", (value "")
[WARN]: Failed to match key "device_key_4x", (value "")
[WARN]: Failed to match key "retail_specific_aes_key_source", (value "")
[WARN]: Failed to match key "rsa_oaep_kek_generation_source", (value "")
[WARN]: Failed to match key "rsa_private_kek_generation_source", (value "")
Invalid NCA header! Are keys correct?
Done!

I'm trying to extract the NSPs of my downloaded content as per this guide to be able to install again on my switch, after similar issues happened while using SwitchSDTool, but I keep getting stuck at this step.

Is there anything else I should be trying?

@bao3
Copy link

bao3 commented Dec 27, 2020

OK. I had the same issue,but I fixed it , just put the prod.keys at $HOME/.switch

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

4 participants