3.3.7.2 Session Socket Successfully Set Up Event

When a Share Receiver's Socket has been successfully set up (section 3.1.7), the Share Receiver state MUST transition to ReplyHeaderAndReceivingIV (section 3.3.1), and the following actions MUST be performed:

  1. Synchronously read 2 bytes for the HeaderSize field of a Share header (section 2.2.2) from the Socket.

  2. Interpret the 2 bytes as a little-endian encoded 16-bit unsigned integer that specifies how many bytes to read for the rest of the message.

  3. If nonzero length, synchronously read (HeaderSize – 2) bytes from the Socket.

    Note  If the HeaderSize value is exactly 2, there is nothing to read.

  4. If the total received HeaderSize value is greater than or equal to 10 (0x0A, 0x00), bytes 3 through 10 are to be interpreted as the TotalContentSizeEstimate field of the message, which is a little-endian encoded 64-bit unsigned integer.

  5. All bytes received in the Share header after the 10th byte MUST be ignored.

  6. Create a Reply header (section 2.2.3) with the following value:

    • HeaderSize: The value 2 in little-endian encoding (0x02, 0x00). No other value is valid.

  7. Set the Share Receiver's SymmetricKey element to a 128-bit key derived by taking the SHA256 hash of the Session object's SharedSecretKey element.

  8. Prepare the Share Receiver to receive the IV as the next 16 bytes of the data stream.

  9. Send the Reply header over the Socket.

  10. The next 16 bytes received MUST be set as the Share Receiver's IV element. After these 16 bytes have been received, the state MUST transition to ReceivingPackage.