I found a need for hactoolnet recently and struggled with the command line a bit until I got it, figure I post it here for future reference. A prior warning here, any modifications to the Nintendo Switch partition and any files within may result in data corruption, the worst case may be bricking the Switch. Now that we are aware of the risk, before attempting any of the steps below, make sure you have a good NAND backup as well as back up of the save files.
# 1. Read the save file from the User partition (e.g. User\save\000000000000000a). Note the CMAC Signature line is FAIL because we have not provided the proper key to verify its signature yet hactoolnet.exe -t save 000000000000000a
# 2. Extract the save file with the proper key file (-t keys.txt). The key file essentially is a copy of the prod.keys and title.keys combined if you have backed it up with Lockpick_RCM hactoolnet.exe -k keys.txt -t save --outdir output_folder 000000000000000a
# 3. Repack the extracted directory and sign it with the Switch's device key you like to transfer to. It needs an actual save file (e.g. 000000000000000a) to overwrite to, that's where it was confusing for me hactoolnet.exe -k keys.txt --sign --repack .\output_folder -t save 000000000000000a
# 4. Verify if the repacked/signed save file with the same key as in the last step. It should have "CMAC Signature (GOOD)" instead of "CMAC Signature (FAIL)" hactoolnet.exe -k keys.txt -t save 000000000000000a
Now we can put the save file (e.g. 000000000000000a) back to the User partition (e.g. User\save\000000000000000a) now. If we are putting in on a different Switch, just make sure to match the file name which you will overwrite.
Source
[1] Search in GBAtemp for "Edit OFW clean Switch save data from NAND backup/restoring via Fusee Gelee payloads", the author laid out a very detailed instruction and example for hactoolnet
LibHac is a .NET Framework and .NET Core library for reading and editing file formats used by the Nintendo Switch.
Supported formats
NCA
XCI
NAX0
PFS0/HFS0/NSP
RomFS
Save file
Package1
Package2
INI1/KIP1
CNMT
NACP
Ticket
PRODINFO
Switch NAND and SD card
Additional features
Save file editing and signing
PFS0 creation
Switch key derivation
Integrity verification of NCA, XCI, etc.
Personalized title key reading
Read, parse and display information about a Switch NAND or SD card
Extract NCA, RomFS and other formats directly from an SD card or NAND, including patched titles
And more!
hactoolnet
Hactoolnet is a tool that uses LibHac for viewing and extracting data from common Nintendo Switch file formats. It partially mimics hactool's interface.
Features
Dump the container formats that LibHac supports
A progress bar!
Save file signing
Dump RomFS directly from an XCI or SD card
Dump SD card titles as NSP files
Verify the integrity of all titles on a Switch SD card
Switch key derivation
Automatic integrity verification of NCA, XCI, etc.
Give information about the titles and applications on a Switch NAND or SD card
Extract NCA, RomFS and other formats directly from an SD card or NAND, including patched titles
It wasn't too long ago we saw our first glimpse of Courage Reborn, another Twilight Princess PC port in the works based on last year's decompilation efforts. With...
After much speculation, Nintendo has finally followed their competitors in announcing price increases for their hardware.
You can find a breakdown of what's changing...
Seemingly out of nowhere a PC port for Pokemon Platinum has surfaced online, bundled alongside the source code for those interested in building and developing it for...
Airing last night with very little in the way of warning, a brand new Nintendo Direct was aired. Running for 15 minutes in total, it took a moment to celebrate the...
Known more widely for their unusual stock price in modern times, GameStop has seen a steady decline as the go-to retail space for US gamers. In what feels like an...
With very little in the way of announcement, Valve has today increased the price of the Steam Deck but some fairly considerable margins. Both of the available models...
As a part of their Financial Results Briefing for the previous year, Nintendo president Shuntaro Furukawa took to the floor to answer key questions around the Switch...
Earlier this year, Sony announced major price increases for the PS5, PS5 Pro, and PlayStation Portal. Now the company is raising prices again, this time for...
We are once again here to tell you about a game leaking before its release, but for once, it's not one published by Nintendo. The game files for Microsoft's upcoming...
Continuing with the great news of Pokémon Platinum getting a native unofficial PC port just a few days ago, today, yet another classic title from the franchise has...
It wasn't too long ago we saw our first glimpse of Courage Reborn, another Twilight Princess PC port in the works based on last year's decompilation efforts. With...
With very little in the way of announcement, Valve has today increased the price of the Steam Deck but some fairly considerable margins. Both of the available models...
After much speculation, Nintendo has finally followed their competitors in announcing price increases for their hardware.
You can find a breakdown of what's changing...
Airing last night with very little in the way of warning, a brand new Nintendo Direct was aired. Running for 15 minutes in total, it took a moment to celebrate the...
Known more widely for their unusual stock price in modern times, GameStop has seen a steady decline as the go-to retail space for US gamers. In what feels like an...
Seemingly out of nowhere a PC port for Pokemon Platinum has surfaced online, bundled alongside the source code for those interested in building and developing it for...
Earlier this year, Sony announced major price increases for the PS5, PS5 Pro, and PlayStation Portal. Now the company is raising prices again, this time for...
As a part of their Financial Results Briefing for the previous year, Nintendo president Shuntaro Furukawa took to the floor to answer key questions around the Switch...
The latest in a growing number of native PC ports, Paper Mario ReCut got its first pre-release build earlier this week. Based on the N64 recompilation toolchain, the...
A whole hour of PlayStation content is on the way, thanks to the latest State of Play showcase. Headlining the stream will be Marvel's Wolverine, alongside a...