3.2.5.3.10 Sending Security Exchange PDU

The structure and fields of the Security Exchange PDU are specified in section 2.2.1.10.

The tpktHeader field is initialized as specified in [T123] section 8, while the x224Data field (which contains an X.224 Class 0 Data TPDU) is initialized as specified in [X224] section 13.7.

The mcsSDrq field is initialized as specified in [T125] section 11.32. The embedded initiator field MUST be set to the User Channel ID (held in the User Channel ID store (section 3.2.1.5)) and the embedded channelId field MUST be set to the MCS I/O channel ID (held in the I/O Channel ID store (section 3.2.1.3). The embedded userData field contains the remaining fields of the Security Exchange PDU.

The embedded flags field of the basicSecurityHeader MUST contain the SEC_EXCHANGE_PKT (0x0001) flag (specified in section 2.2.8.1.1.2.1) to indicate the PDU type. If the client can handle encrypted licensing packets from the server and Standard RDP Security mechanisms (sections 5.3 and 5.4) are being used, then the SEC_LICENSE_ENCRYPT_SC (0x0200) flag SHOULD also be included in the flags subfield of the basicSecurityHeader field.

A 32-byte random number MUST be generated and then encrypted using the public key of the server and the techniques specified in section 5.3.4.1. The public key of the server is embedded in the server's certificate, which is held in the serverCertificate field of the Server Security Data (section 2.2.1.4.3) sent in the MCS Connect Response PDU with GCC Conference Response (section 3.2.5.3.4). Once the 32-byte random number has been successfully encrypted, it MUST be copied into the encryptedClientRandom field. The size of the encryptedClientRandom field MUST be derived as specified in section 5.3.4.1. After the encrypted client random has been copied into the encryptedClientRandom buffer, 8 bytes of padding (which MUST be filled with zeroes) will remain.

Once the client has sent the Security Exchange PDU, it MUST generate the session keys which will be used to encrypt, decrypt, and sign data sent on the wire. The 32-byte client random and server random (transmitted in the Server Security Data (section 2.2.1.4.3)) are used to accomplish this task by employing the techniques specified in section 5.3.5. On successful generation of the session keys, the client MUST send the Client Info PDU to the server (section 3.2.5.3.11) and store the session keys in the Session Keys store (section 3.2.1.12).