Friend Services: Difference between revisions

TimmSkiller (talk | contribs)
No edit summary
TimmSkiller (talk | contribs)
Add information about ApproachContexts
Line 507: Line 507:
|}
|}


=Approach Contexts=
The approach context (in the form of an [[Friend_Services#Encrypted_ApproachContext_Payload|encrypted payload]]) of the console can be retrieved using [[FRDU:GetMyApproachContext]].
[[Friend_Services#Encrypted_ApproachContext_Payload|Encrypted payloads]] can be decrypted using [[FRDU:DecryptApproachContext]].
It is possible to add a friend using an [[Friend_Services#Encrypted_ApproachContext_Payload|encrypted payload]] using [[FRDA:AddFriendWithApproach]].
==ApproachContext==
{| class="wikitable" border="1"
|-
! Offset !! Size !! Description
|-
| 0x0 || 0x48 || [[Friend_Services#Friend_Profile|Friend Profile]] of the console that created this approach context
|-
| 0x48 || 0x1 || bool, Has Mii
|-
| 0x49 || 0x1 || bool, Profanity Flag
|-
| 0x4A || 0x1 || u8, [[Mii#Mii_format|Mii Character Set]]
|-
| 0x4B || 0x70 || [[Friend_Services#Mii_Data|Friend Mii Data]] wrapped using [[APT:Wrap]]
|-
| 0xBB || 0x16 || 10-Character UTF-16 Screen Name (10 characters + null termination)
|-
| 0xD1 || 0x10F || unused
|}
==Encrypted ApproachContext Payload==
{| class="wikitable" border="1"
|-
! Offset !! Size !! Description
|-
| 0x0 || 0x1 || (u8) unknown, initialized to 1 internally, set to 1 when the PS encryption command succeeds, otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned
|-
| 0x1 || 0x1 || (u8) unknown, always set to 0
|-
| 0x2 || 0x1 || (u8) unknown, initialized to 2 internally, always set to either 1 when the PS encryption command succeeds, or otherwise 0. Must be 1 when decrypting, otherwise error 0xE0E0C4E9 is returned
|-
| 0x3 || 0x1 || (u8) unknown, always set to 0
|-
| 0x4 || 0x4 || u32, Principal ID (part of nonce)
|-
| 0x8 || 0x8 || u64, Friend Code (part of nonce)
|-
| 0x10 || 0x1E0 || [[Friend_Services#ApproachContext|ApproachContext]]
|-
| 0x1F0 || 0x10 || AES-CCM MAC over the encrypted payload at 0x10 thru 0x1F0
|}