Skip to content

Setup Key File

finthetechguy edited this page Nov 23, 2026 · 3 revisions

Making the key file

StreetPass links are encrypted, and the encryption key is derived from secrets stored in every 3DS. ctrpass needs those secrets from your own console. They all go into one text file, the key file.

What the key file contains

The key file is generated from your dumped aes_keys.txt, StreetPass system module dump and CEC save data dump.

Entry Size Required Used for
slot0x2EKeyN, or both slot0x2EKeyX and slot0x2EKeyY 16 bytes Yes Encrypting the link key.
streetpassHmacKey 16 bytes Yes Deriving each link's key.
titleKeyXXXXXXXX 32 bytes Yes Signing messages for the game with that CEC title ID, e.g. titleKey00020800 for StreetPass Mii Plaza.
slot0x31KeyN, or slot0x31KeyX and slot0x31KeyY 16 bytes No Reading and building Mii records. Needed for Mii Plaza messages.

1. Dump files from your console

These steps require GodMode9 on a console with custom firmware.

1. aes_keys.txt: AES keyslots
Contains `0x2E` and `0x31` keys.
  1. Start GodMode9 on your modded (boot9strap) 3DS.
    • Hold START while booting and select GodMode9 if prompted.
  2. Run the 'DumpKeys' script, which exports `sdcard/gm9/aes_keys.txt'.
    • Press HOME -> Scripts... -> DumpKeys
    • If missing, download DumpKeys and place in <3DS SD Card>/gm9/scripts/
  3. Insert SD Card and copy <3DS SD Card>/gm9/aes_keys.txt to your computer.
2. cecd: StreetPass system module
Used for getting the HMAC key constant. On your console, with GodMode9 open (see 1.)
  1. Open the NAND Title manager
    • Press HOME -> Title manager -> [1:] NAND / TWL
    • A list of system apps and titles should appear.
  2. Find the 'cecd' entry.
    • Look for 0004013000002602 (1125pseg-ciuser)
  3. Select the entry and open the title directory
    • Press A on that entry you found.
    • Select 'Open title folder'
  4. Extract cecd's code.bin
    • Press A on '00000016.app'
    • Press NCCH image options... -> Extract .code
    • If done correctly, your SD card should contain gm9/out/0004013000002602.dec.code
  5. Copy to your computer and rename to code.bin
    • Insert the SD card into your computer and put the '...dec.code' file you dumped somewhere safe with the file renamed to 'code.bin', e.g. at ~/code.bin
3. cec-save.bin: CEC save data partition
On your console, with GodMode9 open (see 1.)
  1. Open the NAND filesystem
    • Navigate to '[1:] SYSNAND CTRNAND' in the GodMode9 main menu.
  2. Go to data/[yourid]/sysdata/00010026 directory
    • You should see one file: '00000000'
  3. Mount CEC partition
    • Press A on '00000000'
    • Select 'Mount as DISA image'
    • Press A for yes to enter the path of the mounted CEC partition.
  4. Copy partitionA.bin to your SD card
    • If mounted correctly, you should see 'partitionA.bin'
    • Press A on this file and 'Copy to 0:/gm9/out'.
  5. Copy to your computer and rename to CEC-partition.bin
    • Insert the SD card into your computer and put the 'partitionA.bin' file you dumped somewhere safe with the file renamed to 'cec-save.bin'

Copy the files to your computer, preferably to the same directory, they can be safetly removed afterwards.

2. Add the StreetPass keys with ctrpass keys

ctrpass keys reads the module and the save, finds the keys, and appends them to the key file.

mkdir -p ~/.config/ctrpass
cp aes_keys.txt ~/.config/ctrpass/keys
cp 00000000 cec-save.bin
ctrpass --keys ~/.config/ctrpass/keys keys --module code.bin --titles cec-save.bin
  • --module finds streetpassHmacKey. If ctrpass reports that no key string was found, the module is still encrypted or compressed. Extract it again. If the search fails on a correctly decrypted module, pass the key's file offset with --offset.
  • --titles reads the signing key of every game in a CEC save data partition or CEC folder. It can be given more than once.
  • Without --keys or CTRPASS_KEYS, the command writes to ~/.config/ctrpass/keys.

The file is written so only your user can read it. Keep it private as it holds your console's keys.

3. Point ctrpass to the file

  • Command line: pass --keys PATH, or set CTRPASS_KEYS=PATH.
  • Desktop app: choose the file in Preferences -> Keys -> Key file. The row then shows how many games it has signing keys for.

Next: Building and installing

Clone this wiki locally