NULL

How to get Switch Keys for Hactool/XCI Decrypting

Discussion in 'Switch - Tutorials' started by PRAGMA, Jun 10, 2018.

  1. lacrima08

    lacrima08 Member

    Newcomer
    4
    May 28, 2009
    France
    Hi all,

    I got successfully 40 keys with the python script file but when I attempt to extract a XCI file, I got this error : "Invalid NCA header! Are keys correct?"

    I added manually master_key_01 / master_key_02 / master_key_03 because they wren't in the prods.keys generated file

    What's wrong ?

    PS : BOOT0 and BCPKG2-1-Normal-Main are from a 5.1.0 backup and no errors or warning when using python script :

    Using BOOT0.bin to get keys from package1...
    Deriving keys...
    Decrypting package1...
    Using Secure_Monitor.bin to get keys to decrypt package2...
    Decrypting package2...
    Decompressing spl.kip1 and FS.kip1...
    Getting keys from spl...
    Getting keys from FS...
    Doing final key derivation...
    If there were no warnings, we found all the keys!

     
    Last edited by lacrima08, Jul 15, 2018
  2. Indigo Marz

    Indigo Marz Indigo Marz - No HooX

    Member
    4
    Aug 4, 2011
    United States
    Funcoland
    'python' is not recognized as an internal or external command.........

    my setup:
    python is in C:\

    hactools on desktop

    BOOT0 BCPKG2 and keys.py in hactools

    Regular CMD: c\users\...\desktop\hactool>python keys.py (SBK characters) (TSEC characters)

    *Hits Enter*

    'python' not recognized.....

    can someone help, ive done the cd into hactools with normal and admin cmd
     
  3. Bigjokker

    Bigjokker GBAtemp Regular

    Member
    3
    Jan 4, 2015
    United States
    hactool.exe -k keys.py -t xci -x *whatever-file.XCI

    Don't forget to tell it what type of file
     
  4. Canna

    Canna Bad Ass Poisonous Mushroom

    Member
    7
    GBAtemp Patron
    Canna is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 14, 2018
    United Kingdom
    IF YOUR LIKE ME AND GOT THIS ERROR BY THINKING U CAN USE HACTOOL 1044 THE GUI .EXE THEN THINK AGAIN
    ONCE I DOWNLOAD hactool -1.1.0
    and placed them files in the hactool folder along side the hactool gui .exe
    i run the script and it all worked

    so if you get similar error below try this step above

    C:\Windows\system32>cd C:\Users\mini\Desktop\Hactool

    C:\Users\mini\Desktop\Hactool>python keys.py Keys my keys here removed for privacy

    Using BOOT0.bin to get keys from package1...
    Deriving keys...
    Traceback (most recent call last):
    File "keys.py", line 374, in <module>
    stage0_results = subprocess.check_output([HACTOOL_PATH, "--keyset=keys.txt",
    "--intype=keygen", "BOOT0.bin"])
    File "C:\Python27\lib\subprocess.py", line 216, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
    File "C:\Python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)
    File "C:\Python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)
    WindowsError: [Error 2] The system cannot find the file specified




    My key.txt file last entry was keyblob_mac_key_source =My key hidden
     
    Last edited by Canna, Jul 16, 2018
  5. lacrima08

    lacrima08 Member

    Newcomer
    4
    May 28, 2009
    France
    This time, I get : Error: "Invalid XCI partition!" (with keys.dat and not keys.py) CRC/SHA of XCI files matches with online database

    Edit : seems to be on a 4.1.0 Game
     
    Last edited by lacrima08, Jul 16, 2018
  6. AnagraM

    AnagraM Advanced Member

    Newcomer
    3
    Nov 14, 2013
    Belgium
    Hi,
    I follow the tutorial, it gives me no error, and the key file is generated, though it's uncomplete. I only have 27 keys generated.
    I'm on 2.3.
    Any insight ?
     
  7. feidhlim1986

    feidhlim1986 GBAtemp Fan

    Member
    3
    Oct 18, 2008
    Python looks to not be in your Windows PATH variables.

    Provide the full path to python.exe rather than just typing “python”

    Eg
    >”C:\somedirectory\python.exe keys.py
     
  8. Jax_Ripper

    Jax_Ripper Advanced Member

    Newcomer
    3
    Apr 25, 2017
    United States
    How exactly do you make that change??
    Thanks in Advance, Jax.

    EDIT: I keep getting an error when I type in "cd Desktop/hactool", can't find path specified!
    Is there a fix for this??
     
    Last edited by Jax_Ripper, Jul 19, 2018
  9. CuriousTommy

    CuriousTommy GBAtemp Advanced Fan

    Member
    4
    Jul 22, 2014
    United States
    When you download the python script, use your favorite text editor (I used sublime text) to search for HACTOOL_PATH and edit the stuff there.

    The script expects the application to be next to it. Make sure you set it up like that.
     
    Jax_Ripper likes this.
  10. Kuin

    Kuin Newbie

    Member
    1
    Feb 14, 2015
    France
    Hey there! Thanks for the tutorial, but I've a problem on the "python" part (I'm not very good in those things).

    I did everything as said from step 1 to step 3, but at step 4 I've a problem... I get this when I try the "python keys.py ReplaceMeWithSBK ReplaceMeWithTSEC" command.

    C:\Users\MYPCNAME\Desktop\hactool>python keys.py ReplaceMeWithSBK ReplaceMeWithTSEC
    Using BOOT0.bin to get keys from package1...
    Deriving keys...
    Key (ReplaceMeWithTSEC) must be 32 hex digits!
    Traceback (most recent call last):
    File "keys.py", line 374, in <module>
    stage0_results = subprocess.check_output([HACTOOL_PATH, "--keyset=keys.txt", "--intype=keygen", "BOOT0.bin"])
    File "C:\Python27\lib\subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
    subprocess.CalledProcessError: Command '['hactool', '--keyset=keys.txt', '--intype=keygen', 'BOOT0.bin']' returned non-zero exit status 1


    What did I do wrong? Thanks, I'm stuck here. :(
     
  11. Kuin

    Kuin Newbie

    Member
    1
    Feb 14, 2015
    France
    OK it's exactly the problem I have that you quoted, but I don't understand your answer... What means "raplace XXX and XXX on yours keys on step one"?

    OK got it... Damn I didn't understand that I should put the SBK and TSEC codes I had... I really thought I need to copy the whole line like that... I'm dumb.
     
    Last edited by Kuin, Jul 22, 2018
  12. tomman321

    tomman321 GBAtemp Regular

    Member
    3
    Feb 4, 2016
    United States
    This happens every time I try to run keys.py

    upload_2018-7-27_17-51-4.
     
  13. Canna

    Canna Bad Ass Poisonous Mushroom

    Member
    7
    GBAtemp Patron
    Canna is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 14, 2018
    United Kingdom
    This guide is a little complicated for some, but there is a easier way to get all your keys , i believe also this method doesn't get them all

    this is the easy way to get all your keys
    Place this in your homebrew directory on your sd card and run it it will dump the keys to a text file on your sd

    https://github.com/tesnos/kezplez-nx/releases

    Instructions:

    1. Launch hekate (ipl.bin attached), and dump your fuses (not kfuses!) and tsec_keys by going through the menus
    • For fuses, Console Info -> Print fuse info -> Press power button
    • For tsec_keys, Console Info -> Print TSEC keys -> Press power button
    IF YOU ARE ON 1.0.0 - 2.3.0, ALSO DO THE FOLLOWING IN HEKATE:
    • Tools -> Backup -> Backup eMMC BOOT0/1
    • Tools -> Dump package1/2
    1. Launch CFW so you can access homebrew

    2. Put kezplez-nx.nro and kezplez-nx.nacp in "/switch/kezplez-nx" on your sd card.

    3. Launch it, read the information presented, then press A to have the magic happen.
    You'll find the keys on your sd card at "/keys.txt". Enjoy!
     
    Last edited by Canna, Jul 28, 2018
    RahFah, Kenji177 and Jax_Ripper like this.
  14. Jax_Ripper

    Jax_Ripper Advanced Member

    Newcomer
    3
    Apr 25, 2017
    United States
    Thank you>But I already got my keys.(I will use this in the future though, Thank You,Again!)

    To answer my own question.....Yes!, you can type the keys to notepad, txt file or whatever you use (Not Advisable!!.
    Use the program above, it will do the job without any mistakes. ;)

    Jax
     
    Canna likes this.
  15. Sebi_Zocer

    Sebi_Zocer Newbie

    Newcomer
    1
    Jul 27, 2018
    Germany
    Hey guys,

    if you got the error down below, you need your TSEC key:
    Download Hekate, inject payload, navigate to "Console Info" and select "Print TSEC key". Then you will see 3 keys, but you need the 1. key.

    Have a nice day
     

    Attached Files:

    Last edited by Sebi_Zocer, Aug 1, 2018
  16. Canna

    Canna Bad Ass Poisonous Mushroom

    Member
    7
    GBAtemp Patron
    Canna is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 14, 2018
    United Kingdom
    Erm dude we covered this in thread but thanks :unsure::wacko:
     
  17. Sebi_Zocer

    Sebi_Zocer Newbie

    Newcomer
    1
    Jul 27, 2018
    Germany
    I wanted to use a img of an error and this should be the fix, but i cant upload images, so i posted it without img and want to edit it if i can use imgages.
     
  18. Canna

    Canna Bad Ass Poisonous Mushroom

    Member
    7
    GBAtemp Patron
    Canna is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 14, 2018
    United Kingdom
    You can insert images via a link or click upload file
     
  19. Sebi_Zocer

    Sebi_Zocer Newbie

    Newcomer
    1
    Jul 27, 2018
    Germany
    But i get this message:

    The following error occurred:
    Your content can not be submitted. This is likely because your content is spam-like or contains inappropriate elements. Please change your content or try again later. If you still have problems, please contact an administrator.

    Please note if you are a NEW MEMBER you are unable to post any content that contains hyperlinks of any kind. Please ensure your post does not contain any links especially if you are quoting someone or replying to their post.
     
  20. Canna

    Canna Bad Ass Poisonous Mushroom

    Member
    7
    GBAtemp Patron
    Canna is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 14, 2018
    United Kingdom
    Ok then try upload/attach a file rather then using a http link

    — Posts automatically merged - Please don't double post! —


    Use the method in my thread
    https://gbatemp.net/threads/backup-your-nand-get-your-biskeys-tseckeys-keys-txt.513386/

    the kezplez Method

    these will give you More Keys then the method your using
     
    Last edited by Canna, Aug 1, 2018
    Sebi_Zocer likes this.
Loading...
NULL