Migration services: Difference between revisions

No edit summary
Line 724: Line 724:
Once connected with [[LDN_services|ldn]], the client node connects to the server with TCP port 441.
Once connected with [[LDN_services|ldn]], the client node connects to the server with TCP port 441.


The first byte of messages is the message-type.
== AdvertiseData ==
 
Messages are encrypted with AES-128-GCM. The key is derived during the initial message-handling loop (WaitConnectionAsync).
 
= AdvertiseData =
These sections document the initial [[LDN_services|AdvertiseData]] used by migration.
These sections document the initial [[LDN_services|AdvertiseData]] used by migration.


Line 737: Line 733:
The Uuid used below is generated with <code>nn::util::GenerateUuid</code>.
The Uuid used below is generated with <code>nn::util::GenerateUuid</code>.


== user ==
=== user ===
Used by nn::migration::user::*.
Used by nn::migration::user::*.


Line 758: Line 754:
* 0x100-byte salt
* 0x100-byte salt


== savedata ==
=== savedata ===
Used by nn::migration::savedata::*.
Used by nn::migration::savedata::*.


Line 810: Line 806:
* 0x100-bytes salt
* 0x100-bytes salt


== device ==
=== device ===
Used by nn::migration::device::*.
Used by nn::migration::device::*.


Line 836: Line 832:
* ServerProfile
* ServerProfile
* 0x100-bytes salt
* 0x100-bytes salt
== Messages ==
Names are unofficial.
Messages sent over the TCP socket start with the following header:
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x1 || MessageId
|-
| 0x1 || 0x7 ||
|}
Data specific to each message follows.
Messages are encrypted with AES-128-GCM (excluding the KeyExchange messages). The key is derived during the messsage-handling for KeyExchange.
The message size must match the expected fixed-size for the MessageId.
Offsets in the below sections are relative to header+0.
=== Client ===
This section documents messages sent from the client to the server.
{| class="wikitable" border="1"
|-
! MessageId || Description
|-
| 0 || [[#KeyExchange|KeyExchange]]
|}
==== KeyExchange ====
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
|}
=== Server ===
This section documents messages sent from the server to the client.
{| class="wikitable" border="1"
|-
! MessageId || Description
|-
| 0 || [[#KeyExchange_2|KeyExchange]]
|}
==== KeyExchange ====
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x8 || 0x10 || Ctr for [[SPL_services|ComputeCtr]] with the below data.
|-
| 0x18 || 0x70 || Data encrypted with [[SPL_services|ComputeCtr]].
|-
| 0x88 || 0x10 || CMAC over the above plaintext data ([[SPL_services|ComputeCmac]]).
|}


= Notes =
= Notes =