So you want to decrypt switch content ? Well, the good news is that all the tools required to do that are written up! The great news is, since this is crypto we're talking about, you'll have to find the keys. Yourself. Like it's easter.
So here you can find a template of the $HOME/.switch/prod.keys
file that hactool uses to decrypt content. It contains all the SHA256 and location of the keys and seeds, so you can find them yourselves.
Note that all the seeds (the keys that end with _source
) are used along with the master_key_##
to derive an actual key.
If you have somehow obtained the key without the seed, you can rename xxx_source
to xxx_##
(where ## is the master key number) and put your key there.
If you have a dump of that archive 0100000000000819 and the master_key
and package1_key
for the version of your
switch, you can find all the other key_sources
by looking in the right files for a 16-byte values that match the
sha256sums given in the below file. As a reminder
master_key_00
: 1.0.0-2.3.0master_key_01
: 3.0.0master_key_02
: 3.0.1-3.0.2master_key_03
: 4.0.0-current
Good luck with The Hunt. And remember: We believe in your habilities.
-
Q: The hashes are wrong !
A: You are calculating it wrong. Hex is only a representation. Binary is truth. Because I'm such a nice guy, I'll tell you this :
SHA256(00FF00FF) = 7a7bf454c5f3cb1b9d9a20f81417f98d976fe3b3dd52c1b9968f02e89e7e8a2f
-
Q: Why do I need
master_key
andpackage1_key
to get the sources ?A: You need package1_key to decrypt package1, which contains the
Secure_Monitor.bin
. In there you'll find half the seeds, including thepackage2_key_source
.The master_key is then needed (with the package2_key_source) to decrypt the package2, which contains FS, where the other half of the seeds are located.
-
Q: How do I get my hands on 0100000000000819 ?
A: PegaSwitch can get them for you, with
evalfile usefulscripts/dumpArchives.js
. If you're on 1.0.0, you might want to use branch feature-dumpArchives1.0.0 on my fork.Those files are RomFS. You can use hactool to extract them, without any keys. RTFM, I'm not doing your homework for you.
SHA256(0100000000000819.bin_1.0.0) = e057d10a485447e562bb8dea11afdcf3af5af8c4ec7a48f2f98ce47e2213b386
SHA256(0100000000000819.bin_2.0.0) = e4d57511f79b44f5fbe89d15eab38d31b4c5c3c697d0068fb6461a038dc28ac8
-
Q: RTFM ?
A: Read The Fucking Manual.
./hactool --help
will tell you everything else you need. -
Q: Can you just cut the chase and give me the keys ?
A: No. I enjoy watching you suffer.