private SecurityHeaderType GetSecurityHeaderTypeByContext()
{
SecurityHeaderType securityHeaderType;
switch (clientContext.RdpEncryptionLevel)
{
case EncryptionLevel.ENCRYPTION_LEVEL_NONE:
securityHeaderType = SecurityHeaderType.None;
break;
case EncryptionLevel.ENCRYPTION_LEVEL_LOW:
securityHeaderType = SecurityHeaderType.Basic;
break;
case EncryptionLevel.ENCRYPTION_LEVEL_CLIENT_COMPATIBLE:
case EncryptionLevel.ENCRYPTION_LEVEL_HIGH:
case EncryptionLevel.ENCRYPTION_LEVEL_FIPS:
// The following logic is implemented according to actual situation observed,
// since related TD section is involved with [TDI #39940]
if (clientContext.RdpEncryptionMethod == EncryptionMethods.ENCRYPTION_METHOD_40BIT
|| clientContext.RdpEncryptionMethod == EncryptionMethods.ENCRYPTION_METHOD_56BIT
|| clientContext.RdpEncryptionMethod == EncryptionMethods.ENCRYPTION_METHOD_128BIT)
{
securityHeaderType = SecurityHeaderType.NonFips;
}
else if (clientContext.RdpEncryptionMethod == EncryptionMethods.ENCRYPTION_METHOD_FIPS)
{
securityHeaderType = SecurityHeaderType.Fips;
}
else
{
securityHeaderType = SecurityHeaderType.None;
}
break;
default:
throw new FormatException(ConstValue.ERROR_MESSAGE_ENUM_UNRECOGNIZED);
}
return securityHeaderType;
}