public override byte[] ToBytes()
{
List<byte> totalBuffer = new List<byte>();
byte[] fpInputdata = EncodeFpInputData();
byte[] encryptedData = null;
byte[] signature = null;
if (context.RdpEncryptionLevel == EncryptionLevel.ENCRYPTION_LEVEL_FIPS
&& fipsInformation.padlen == 0)
{
fipsInformation.padlen = (byte)(ConstValue.TRIPLE_DES_PAD
- (fpInputdata.Length % ConstValue.TRIPLE_DES_PAD));
}
// encryptionFlags (2 bits): A higher 2-bit field containing the flags
// that describe the cryptographic parameters of the PDU.
bool isSalted = ((fpInputHeader.actionCode >> 6) &
(int)encryptionFlags_Values.FASTPATH_INPUT_SECURE_CHECKSUM)
== (int)encryptionFlags_Values.FASTPATH_INPUT_SECURE_CHECKSUM;
context.Encrypt(fpInputdata, isSalted, out encryptedData, out signature);
if (dataSignature == null)
{
dataSignature = signature;
}
byte[] fpHeaderdate = EncodeFpHeaderData(encryptedData.Length);
RdpbcgrEncoder.EncodeBytes(totalBuffer, fpHeaderdate);
RdpbcgrEncoder.EncodeBytes(totalBuffer, encryptedData);
return totalBuffer.ToArray();
}