Skip to content

Protocol overview

Fin edited this page Nov 14, 2026 · 2 revisions

Protocol overview

A sketch of what happens on the air, at the level you need to read the logs and the code. The detailed reverse-engineering is not part of this release.

The layers

  802.11 management frames        discovery: probes, action frames
  802.11 data frames, CCMP        the encrypted link
    LLC/SNAP
      YY                          a TCP-shaped transport, cecd's own
        CEC objects               the actual payload: title lists, offers, messages

1. Discovery

Consoles advertise on channels 1, 6 and 11 with a StreetPass probe request carrying a Nintendo vendor IE. Inside that IE is a rotating token and the list of titles the console has enabled.

The token is also an input to the key derivation. It rotates per session, on the order of hours.

Tuxchange answers with a probe response, then an action frame, then a directed probe. There is no 802.11 authentication or association at any point, and the console goes straight from discovery to a link BSS.

2. The link key

Both sides derive the same CCMP key from what they have just exchanged:

key17 = cecd's 17-byte HMAC key            (16 ASCII chars + the trailing NUL)
block = consoleID_A | consoleID_B | MAC | MAC      (0x1C bytes)
ctr   = HMAC_SHA1(key17, block)[0:16]
key   = AES_ECB(keyslot_0x2E_normalkey, ctr)

The two console IDs are swapped by role, so each side reorders its own (mine, peer) pair into one agreed absolute order. A passive observer does not know which console held which role, so an offline decryption tool has to try both orderings.

keyslot_0x2E_normalkey comes from your own dump. See Getting your keys.

3. The transport

Inside the CCMP payload, after LLC/SNAP, is a protocol cecd implements itself, recognisable by its 0x5959 magic, which gives it the name YY. It is TCP-shaped: SYN, SYN|ACK, sequence numbers, acknowledgements, a window. Objects larger than a frame are segmented across it and rejoined at the far end.

4. The object exchange

The payload is a sequence of CEC objects, each a 0x6363 wrapper with a type. A real exchange opens with a title list before the offer:

  1. 0x41: who we are
  2. 0x43: a fixed payload
  3. 0x11: the title list, meaning which titles we have something for
  4. 0x21 / 0x31 / 0x33: the offer, and the negotiation of what will be sent
  5. the messages themselves

The offer count is the intersection of both consoles' enabled titles, minus any title with nothing queued. A validator on the far side requires the two counts to match, so declaring a title you have nothing for makes the exchange fail.

5. A message

A CEC message is an envelope, a container header, ex-headers, a body, and a 32-byte HMAC-SHA256 trailer over exactly the body. The key is that title's own key, from its MBoxInfo____ file on the console.

For Mii Plaza the body carries a Mii in an AES-CCM wrapped container (the APT key, keyslot 0x31), a greeting, a profile card, region metadata, and the met-lists. sp_build.py builds one from nothing, without a captured message as a template.

6. Acceptance happens twice

The green notification LED means cecd accepted the message. Mii Plaza then validates the Mii on its own terms and deduplicates on Mii identity, and it ignores the encounter list. A message can pass cecd and still be dropped by the plaza, which is why an exchange can complete with nothing appearing in the plaza.

Further reading

The code is the reference. streetpass_ccmp_key.py implements the key derivation, sp_yy.py and sp_yysession.py implement the transport, and sp_cec.py and sp_build.py implement the message format.

Clone this wiki locally