public StackPacket DecodeEnhancedServerRedirectionPDU(
byte[] data,
byte[] decryptedUserData,
SecurityHeaderType type)
{
Enhanced_Security_Server_Redirection_Pdu pdu = new Enhanced_Security_Server_Redirection_Pdu();
// data index
int dataIndex = 0;
// Server_Redirection_Pdu: commonHeader
pdu.commonHeader = ParseMcsCommonHeader(data, ref dataIndex, type);
// user data index
int userDataIndex = 0;
pdu.shareControlHeader = ParseTsShareControlHeader(decryptedUserData, ref userDataIndex);
pdu.pad = ParseUInt16(decryptedUserData, ref userDataIndex, false);
// Server_Redirection_PDU: serverRedirectionPdu
pdu.serverRedirectionPdu = ParseRdpServerRedirectionPacket(decryptedUserData, ref userDataIndex);
// check if there's paddings
int remainBytes = decryptedUserData.Length - userDataIndex;
if (remainBytes > 0)
{
pdu.pad1Octet = GetBytes(decryptedUserData, ref userDataIndex, remainBytes);
}
// Check if data length exceeded expectation
VerifyDataLength(decryptedUserData.Length, userDataIndex, ConstValue.ERROR_MESSAGE_DATA_LENGTH_EXCEEDED);
return pdu;
}