┌───────┐ ┌────┐ ┌───────┐ │clientA│ │hbbs│ │remoteB│ └───┬───┘ └──┬─┘ └───┬───┘ │ │ │ ╔═══════════╤═╪════════════════════════════════════════════════╪════════════════════════╪═════════════════════════════════════════════════╗ ║ REGISTER │ │ │ │ ║ ╟───────────┘ │ │ 𝟏 Register with hbbs. │ ║ ║ │ │<───────────────────────│ ║ ║ │ │ │ ║ ║ │ │────┐ │ ╔════════════════════════════════════╗ ║ ║ │ │ │ 𝟐 Save peer info. │ ║ID, Address, UUID, PK(Public Key) ░║ ║ ║ │ │<───┘ │ ╚════════════════════════════════════╝ ║ ║ │ │ │ ║ ║ │ │ 𝟑 Register response. │ ║ ║ │ │───────────────────────>│ ║ ║ │ │ │ ║ ║ │ 𝟒 Register with hbbs. │ │ ║ ║ │───────────────────────────────────────────────>│ │ ║ ║ │ │ │ ║ ║ │ │────┐ │ ║ ║ │ │ │ 𝟓 Save peer info. │ ║ ║ │ │<───┘ │ ║ ║ │ │ │ ║ ║ │ 𝟔 Register response. │ │ ║ ║ │<───────────────────────────────────────────────│ │ ║ ╚═════════════╪════════════════════════════════════════════════╪════════════════════════╪═════════════════════════════════════════════════╝ │ │ │ │ │ │ ╔═════════════╪═══╤════════════════════════════════════════════╪════════════════════════╪════════════════════════════════════════╗ ║ TRY TO CONNECT │ │ │ ║ ╟─────────────────┘ 𝟕 Request to establish connection │ │ ║ ║ │ with RemoteID by punching hole. │ │ ║ ║ │───────────────────────────────────────────────>│ │ ║ ║ │ │ │ ║ ║ │ │𝟖 Request remote addr. │ ║ ║ │ │───────────────────────>│ ║ ║ │ │ │ ║ ║ │ │ 𝟗 Return remote addr. │ ╔═══════════════════════════╗ ║ ║ │ │<───────────────────────│ ║Remote Addr, Relay Server ░║ ║ ║ │ │ │ ╚═══════════════════════════╝ ║ ║ │ 𝟏𝟎 Return remote info. │ ╔══════════════════════╧═╗ ║ ║ │<───────────────────────────────────────────────│ ║Remote Addr, Remote PK ░║ ║ ╚═════════════╪════════════════════════════════════════════════╪═╚════════════════════════╝══════════════════════════════════════╝ │ │ │ │ │ │ ╔═════════════╪══════════════════════════════════╤═════════════╪════════════════════════╪═══════════════════════════════════════════╗ ║ ESTABLISH A SECURE CONNECTION BY KEY EXCHANGE │ │ │ ║ ╟───────────────────────────𝟏𝟏 Temporary PK(B' TPK) encrypted with B' SK. │ ║ ║ │<────────────────────────────────────────────────────────────────────────│ ║ ║ │ │ │ ║ ║ │────┐ │ │ ║ ║ │ │ 𝟏𝟐 Decrypt to get B' TPK. │ │ ║ ║ │<───┘ Generate new key pair and symmetirc key . │ │ ║ ║ │ │ │ ║ ║ │ │ │ ║ ║ │ 𝟏𝟑 sealed symmetirc key, A' TPK. │ ║ ║ │────────────────────────────────────────────────────────────────────────>│ ║ ║ │ │ │ ║ ║ │ │ │────┐ ║ ║ │ │ │ │ 𝟏𝟒 Decrypt to get symmetirc key ║ ║ │ │ │<───┘ by using A' TPK and B'TSK. ║ ║ │ │ │ ║ ╚═════════════╪════════════════════════════════════════════════╪════════════════════════╪═══════════════════════════════════════════╝ │ │ │ │ │ │ ╔═════════════╪══════════════════════════════════╤═════════════╪════════════════════════╪══════════════════════════════╗ ║ ENCRYPED COMMUNICATION BY USING SYMMETIRC KEY │ │ │ ║ ╟──────────────────────────────────────────𝟏𝟓 Control data │ │ ╔═════════════════╗ ║ ║ │────────────────────────────────────────────────────────────────────────>│ ║Keyboard, Mouse ░║ ║ ║ │ │ │ ╚═════════════════╝ ║ ║ │ 𝟏𝟔 Audio frame, vidio frame, clipboard │ ║ ║ │<────────────────────────────────────────────────────────────────────────│ ║ ╚═════════════╪════════════════════════════════════════════════╪════════════════════════╪══════════════════════════════╝ │ │ │ ════════════════════════╪════════════════════════════════════════════════╪════════════════════════╪════════════════════════════════════════════════════════════ ┌───┴───┐ ┌──┴─┐ ┌───┴───┐ │clientA│ │hbbs│ │remoteB│ └───────┘ └────┘ └───────┘