protected void triggerClientRDPConnect(EncryptedProtocol enProtocol, bool fullScreen = false) { int iResult; string strMethod = null; switch (enProtocol) { // negotiation based approach case EncryptedProtocol.Rdp: case EncryptedProtocol.NegotiationCredSsp: case EncryptedProtocol.NegotiationTls: { if (fullScreen) { iResult = this.sutControlAdapter.RDPConnectWithNegotiationApproachFullScreen(this.TestContext.TestName); } else { iResult = this.sutControlAdapter.RDPConnectWithNegotiationApproach(this.TestContext.TestName); } strMethod = "RDPConnectWithNegotiationApproach"; } break; // direct approach case EncryptedProtocol.DirectCredSsp: { if (fullScreen) { iResult = this.sutControlAdapter.RDPConnectWithDirectCredSSPFullScreen(this.TestContext.TestName); } else { iResult = this.sutControlAdapter.RDPConnectWithDirectCredSSP(this.TestContext.TestName); } strMethod = "RDPConnectWithDirectCredSSP"; } break; default: { throw new InvalidOperationException($"Unexpected encryption protocol: {enProtocol}!"); } } TestSite.Assert.IsTrue(iResult >= 0, "SUT Control Adapter: {0} should be successful: {1}.", strMethod, iResult); }
protected void triggerClientRDPConnect(EncryptedProtocol enProtocol, bool fullScreen = false) { int iResult = 0; string strMethod; if (enProtocol == EncryptedProtocol.Rdp || enProtocol == EncryptedProtocol.NegotiationCredSsp || enProtocol == EncryptedProtocol.NegotiationTls) { if (fullScreen) { iResult = this.sutControlAdapter.RDPConnectWithNegotiationApproachFullScreen(); } else { iResult = this.sutControlAdapter.RDPConnectWithNegotiationApproach(); } strMethod = "RDPConnectWithNegotiationApproach"; } else if (enProtocol == EncryptedProtocol.DirectCredSsp) { if (fullScreen) { iResult = this.sutControlAdapter.RDPConnectWithDirectCredSSPFullScreen(); } else { iResult = this.sutControlAdapter.RDPConnectWithDirectCredSSP(); } strMethod = "RDPConnectWithDirectCredSSP"; } else { if (fullScreen) { iResult = this.sutControlAdapter.RDPConnectWithDirectTLSFullScreen(); } else { iResult = this.sutControlAdapter.RDPConnectWithDirectTLS(); } strMethod = "RDPConnectWithDirectTLS"; } TestSite.Assume.IsTrue(iResult >= 0, "SUT Control Adapter: {0} should be successful: {1}.", strMethod, iResult); }
/// <summary> /// Establish the RDPBCGR connection with RDP server /// If the SVCNames is not null, then a RDPEDYC static channel is created. /// </summary> /// <param name="encryptProtocol">Encryption protocol, RDP, TLS, Credssp </param> /// <param name="requestedProtocols"></param> /// <param name="SVCNames">Static virtual virtual name, DRDYNVC for EDYC channel name</param> /// <param name="highestCompressionTypeSupported">whether compressed supported </param> /// <param name="isReconnect">whether reconnect supported </param> /// <param name="autoLogon">whether autologon supported </param> /// <param name="supportEGFX">whether EGFX supported </param> /// <param name="supportAutoDetect">whether auto detect supported </param> /// <param name="supportHeartbeatPDU">whether HeartbeatPDU supported </param> /// <param name="supportMultitransportReliable">whether MultitransportReliable supported </param> /// <param name="supportMultitransportLossy">whether MultitransportLossy supported </param> /// <param name="supportAutoReconnect">whether AutoReconnect supported </param> /// <param name="supportFastPathInput">whether FastPathInput supported </param> /// <param name="supportFastPathOutput">whether FastPathOutput supported </param> /// <param name="supportSurfaceCommands">whether SurfaceCommands supported </param> /// <param name="supportSVCCompression">whether SVCCompression supported </param> /// <param name="supportRemoteFXCodec">whether RemoteFXCodec supported </param> public void ConnectToServer(EncryptedProtocol encryptProtocol, requestedProtocols_Values requestedProtocols, string[] SVCNames, CompressionType highestCompressionTypeSupported = CompressionType.PACKET_COMPR_TYPE_RDP61, bool isReconnect = false, bool autoLogon = false, bool supportEGFX = false, bool supportAutoDetect = false, bool supportHeartbeatPDU = false, bool supportMultitransportReliable = false, bool supportMultitransportLossy = false, bool supportAutoReconnect = false, bool supportFastPathInput = false, bool supportFastPathOutput = false, bool supportSurfaceCommands = false, bool supportSVCCompression = false, bool supportRemoteFXCodec = false ) { this.bcgrAdapter.ConnectToServer(encryptProtocol); this.bcgrAdapter.EstablishRDPConnection(requestedProtocols, SVCNames, highestCompressionTypeSupported, isReconnect, autoLogon, supportEGFX, supportAutoDetect, supportHeartbeatPDU, supportMultitransportReliable, supportMultitransportLossy, supportAutoReconnect, supportFastPathInput, supportFastPathOutput, supportSurfaceCommands, supportSVCCompression, supportRemoteFXCodec ); rdpedycClientStack = new RdpedycClient(bcgrAdapter.rdpbcgrClientStack.Context, false); rdpedycClientStack.UnhandledExceptionReceived += (ex) => { Site.Log.Add(LogEntryKind.Debug, $"Unhandled exception from RdpedycClient: {ex}"); }; }
private bool LoadConfig() { if (!IPAddress.TryParse(clientName, out clientAddress)) { clientAddress = Dns.GetHostEntry(clientName).AddressList.First(); } requestedProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; encryptedProtocol = EncryptedProtocol.Rdp; string strWaitTime = DetectorUtil.GetPropertyValue("WaitTime"); if (strWaitTime != null) { int waitTime = Int32.Parse(strWaitTime); timeout = new TimeSpan(0, 0, waitTime); } else { timeout = new TimeSpan(0, 0, 10); } return(true); }
protected void LoadConfig() { #region Security Approach and Protocol string strRDPSecurityProtocol; bool isNegotiationBased = true; if (!PtfPropUtility.GetBoolPtfProperty(Site, "RDP.Security.Negotiation", out isNegotiationBased)) { assumeFailForInvalidPtfProp("RDP.Security.Negotiation"); } requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; if (!PtfPropUtility.GetStringPtfProperty(Site, "RDP.Security.Protocol", out strRDPSecurityProtocol)) { assumeFailForInvalidPtfProp("RDP.Security.Protocol"); } else {//TLS, CredSSP, or RDP if (strRDPSecurityProtocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationTls; } else { transportProtocol = EncryptedProtocol.DirectTls; } } else if (strRDPSecurityProtocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_HYBRID_FLAG; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationCredSsp; } else { transportProtocol = EncryptedProtocol.DirectCredSsp; } } else if (strRDPSecurityProtocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; if (!isNegotiationBased) { this.Site.Log.Add(LogEntryKind.Warning, "The property \"RDP.Security.Protocol\" is not valid and will be ingored. (When use RDP as security protocol, the negotiation-based approch MUST be used."); } transportProtocol = EncryptedProtocol.Rdp; } else { assumeFailForInvalidPtfProp("RDP.Security.Protocol"); } } #region WaitTime string strWaitTime = Site.Properties["WaitTime"]; if (strWaitTime != null) { int waitSeconds = Int32.Parse(strWaitTime); timeout = new TimeSpan(0, 0, waitSeconds); } #endregion #endregion }
protected void LoadConfig() { #region Read and convert properties from PTFCONFIG file #region Security Approach and Protocol string strRDPSecurityProtocol; bool isNegotiationBased = true; if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityNegotiation, out isNegotiationBased)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityNegotiation); } selectedProtocol = selectedProtocols_Values.PROTOCOL_RDP_FLAG; if (!PtfPropUtility.GetStringPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityProtocol, out strRDPSecurityProtocol)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } // Check the combination of RdpSecurityNegotiation and RdpSecurityProtocol if (strRDPSecurityProtocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase)) { selectedProtocol = selectedProtocols_Values.PROTOCOL_SSL_FLAG; this.TestSite.Assume.IsTrue( isNegotiationBased, "When TLS is used as the security protocol, {0} is set to 'TLS', {1} must be true.", RdpPtfPropNames.RdpSecurityProtocol, RdpPtfPropNames.RdpSecurityNegotiation); transportProtocol = EncryptedProtocol.NegotiationTls; } else if (strRDPSecurityProtocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase)) { selectedProtocol = selectedProtocols_Values.PROTOCOL_HYBRID_FLAG; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationCredSsp; } else { transportProtocol = EncryptedProtocol.DirectCredSsp; } } else if (strRDPSecurityProtocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase)) { selectedProtocol = selectedProtocols_Values.PROTOCOL_RDP_FLAG; transportProtocol = EncryptedProtocol.Rdp; } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } #endregion #region Encryption Level string strRDPSecurityEncryptionLevel; enLevel = EncryptionLevel.ENCRYPTION_LEVEL_LOW; if (!PtfPropUtility.GetStringPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityEncryptionLevel, out strRDPSecurityEncryptionLevel)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionLevel); } else {//None, Low, Client, High, FIPS if (strRDPSecurityEncryptionLevel.Equals("None", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_NONE; } else if (strRDPSecurityEncryptionLevel.Equals("Low", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_LOW; } else if (strRDPSecurityEncryptionLevel.Equals("Client", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; } else if (strRDPSecurityEncryptionLevel.Equals("High", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_HIGH; } else if (strRDPSecurityEncryptionLevel.Equals("FIPS", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_FIPS; } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionLevel); } } if (transportProtocol == EncryptedProtocol.Rdp && enLevel == EncryptionLevel.ENCRYPTION_LEVEL_NONE) { this.TestSite.Assert.Fail("When use Standard RDP Security, the encryption level must be greater than None."); } if (transportProtocol != EncryptedProtocol.Rdp && enLevel != EncryptionLevel.ENCRYPTION_LEVEL_NONE) { this.TestSite.Assert.Fail("When use enhanced security protocls (TLS or CredSSP), the encryption level MUST be None."); } #endregion #region Encryption Method string strRDPSecurityEncryptionMethod; enMethod = EncryptionMethods.ENCRYPTION_METHOD_128BIT; if (!PtfPropUtility.GetStringPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityEncryptionMethod, out strRDPSecurityEncryptionMethod)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionMethod); } else {//None, 40bit, 56bit, 128bit, FIPS if (strRDPSecurityEncryptionMethod.Equals("None", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_NONE; } else if (strRDPSecurityEncryptionMethod.Equals("40bit", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_40BIT; } else if (strRDPSecurityEncryptionMethod.Equals("56bit", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_56BIT; } else if (strRDPSecurityEncryptionMethod.Equals("128bit", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_128BIT; } else if (strRDPSecurityEncryptionMethod.Equals("FIPS", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_FIPS; } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionMethod); } } if (enLevel == EncryptionLevel.ENCRYPTION_LEVEL_NONE && enMethod != EncryptionMethods.ENCRYPTION_METHOD_NONE) { this.TestSite.Assume.Fail("When Encryption Level is set to None, the Encryption Method should also set to None."); } if (enLevel == EncryptionLevel.ENCRYPTION_LEVEL_FIPS && enMethod != EncryptionMethods.ENCRYPTION_METHOD_FIPS) { this.TestSite.Assume.Fail("When Encryption Level is set to FIPS, the Encryption Method should also set to FIPS."); } #endregion #region RDP Version rdpServerVersion = TS_UD_SC_CORE_version_Values.V2; #endregion #region WaitTime int waitSeconds; if (!PtfPropUtility.GetIntPtfProperty(TestSite, RdpPtfPropNames.Timeout, out waitSeconds)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.Timeout); } else { waitTime = new TimeSpan(0, 0, waitSeconds); } #endregion #region SUT Display Verification if (!PtfPropUtility.GetBoolPtfProperty(TestSite, "VerifySUTDisplay.Enable", out verifySUTDisplay)) { verifySUTDisplay = false; } int shiftX, shiftY; if (!PtfPropUtility.GetIntPtfProperty(TestSite, "VerifySUTDisplay.Shift.X", out shiftX)) { shiftX = 0; } if (!PtfPropUtility.GetIntPtfProperty(TestSite, "VerifySUTDisplay.Shift.Y", out shiftY)) { shiftY = 0; } sutDisplayShift = new Point(shiftX, shiftY); if (!PtfPropUtility.GetStringPtfProperty(TestSite, "VerifySUTDisplay.BitmapSavePath", out bitmapSavePath)) { bitmapSavePath = @".\"; } // If the bitmap save path is not existed, create it. if (!Directory.Exists(bitmapSavePath)) { Directory.CreateDirectory(bitmapSavePath); } #endregion SUT Display Verification #region Other configrations if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportFastPathInput, out isClientSupportFastPathInput)) { isClientSupportFastPathInput = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportAutoReconnect, out isClientSuportAutoReconnect)) { isClientSuportAutoReconnect = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportRDPEFS, out isClientSupportRDPEFS)) { isClientSupportRDPEFS = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportServerRedirection, out isClientSupportServerRedirection)) { isClientSupportServerRedirection = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportSoftSync, out isClientSupportSoftSync)) { isClientSupportSoftSync = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportTunnelingStaticVCTraffic, out isClientSupportTunnelingStaticVCTraffic)) { isClientSupportTunnelingStaticVCTraffic = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportRdpNegDataEmpty, out isClientSupportEmptyRdpNegData)) { isClientSupportEmptyRdpNegData = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.IsWindowsImplementation, out isWindowsImplementation)) { isWindowsImplementation = true; //if property not found, set to true as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.DropConnectionForInvalidRequest, out DropConnectionForInvalidRequest)) { DropConnectionForInvalidRequest = true; //if property not found, set to true as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, "VerifyRdpbcgrMessage", out bVerifyRdpbcgrMessage)) { bVerifyRdpbcgrMessage = true; //if property not found, set to true as default value } String rdprfxImageFile; if (!PtfPropUtility.GetStringPtfProperty(TestSite, "RDPRFX.Image", out rdprfxImageFile)) { rdprfxImageFile = ""; //if property not found, set to true as default value } String rdprfxVideoModeImageFile; if (!PtfPropUtility.GetStringPtfProperty(TestSite, "RDPRFXVideoMode.Image", out rdprfxVideoModeImageFile)) { rdprfxVideoModeImageFile = ""; //if property not found, set to true as default value } try { //Get image from file image_64X64 = Image.FromFile(rdprfxImageFile); imageForVideoMode = Image.FromFile(rdprfxVideoModeImageFile); } catch (System.IO.FileNotFoundException) { //capture screen if failed to get image from file //Capture 64*64 bitmap for Image Mode image_64X64 = captureScreenImage(0, 0, TileSize, TileSize); //Capture screen bitmap for Vedio Mode imageForVideoMode = captureScreenImage(0, 0, TileSize * VideoMode_TileRowNum, TileSize * VideoMode_TileColNum); } #endregion #endregion #region Logging this.TestSite.Log.Add(LogEntryKind.Debug, @"isClientSupportFastPathInput = {0}; isClientSuportAutoReconnect = {1}; isClientSupportRDPEFS = {2}; isClientSupportServerRedirection = {3}; isClientSupportEmptyRdpNegData = {4}; isClientSupportSoftSync = {5} isClientSupportTunnelingStaticVCTraffic = {6}", isClientSupportFastPathInput, isClientSuportAutoReconnect, isClientSupportRDPEFS, isClientSupportServerRedirection, isClientSupportEmptyRdpNegData, isClientSupportSoftSync, isClientSupportTunnelingStaticVCTraffic); #endregion }
protected void LoadConfig() { #region Security Approach and Protocol string strRDPSecurityProtocol; bool isNegotiationBased = true; if (!PtfPropUtility.GetBoolPtfProperty(Site, RdpPtfPropNames.RdpSecurityNegotiation, out isNegotiationBased)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityNegotiation); } requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; if (!PtfPropUtility.GetStringPtfProperty(Site, RdpPtfPropNames.RdpSecurityProtocol, out strRDPSecurityProtocol)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } else {//TLS, CredSSP, or RDP if (strRDPSecurityProtocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG; this.Site.Assume.IsTrue( isNegotiationBased, "When TLS is used as the security protocol, {0} is set to 'TLS', {1} must be true.", RdpPtfPropNames.RdpSecurityProtocol, RdpPtfPropNames.RdpSecurityNegotiation); transportProtocol = EncryptedProtocol.NegotiationTls; } else if (strRDPSecurityProtocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_HYBRID_FLAG; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationCredSsp; } else { transportProtocol = EncryptedProtocol.DirectCredSsp; } } else if (strRDPSecurityProtocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; transportProtocol = EncryptedProtocol.Rdp; } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } } #region WaitTime string strWaitTime = Site.Properties["WaitTime"]; if (strWaitTime != null) { int waitSeconds = Int32.Parse(strWaitTime); timeout = new TimeSpan(0, 0, waitSeconds); } #endregion #endregion }
private bool LoadConfig() { if (!IPAddress.TryParse(clientName, out clientAddress)) { clientAddress = Dns.GetHostEntry(clientName).AddressList.First(); } bool isNegotiationBased = true; string negotiation = DetectorUtil.GetPropertyValue("RDP.Security.Negotiation"); if (negotiation.Equals("true", StringComparison.CurrentCultureIgnoreCase)) { isNegotiationBased = true; } else if (negotiation.Equals("false", StringComparison.CurrentCultureIgnoreCase)) { isNegotiationBased = false; } else { throw new Exception( String.Format("The property value \"{0}\" is invalid or not present in RDP.Security.Negotiation in ptfconfig", negotiation)); } string protocol = DetectorUtil.GetPropertyValue("RDP.Security.Protocol"); if (protocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase)) { requestedProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG; if (!isNegotiationBased) { throw new Exception( String.Format("When TLS is used as the security protocol, RDP.Security.Negotiation must be true;" + "actually RDP.Security.Negotiation is set to \"{0}\".", negotiation)); } encryptedProtocol = EncryptedProtocol.NegotiationTls; } else if (protocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase)) { requestedProtocol = requestedProtocols_Values.PROTOCOL_HYBRID_FLAG; if (isNegotiationBased) { encryptedProtocol = EncryptedProtocol.NegotiationCredSsp; } else { encryptedProtocol = EncryptedProtocol.NegotiationTls; } } else if (protocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase)) { requestedProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; encryptedProtocol = EncryptedProtocol.Rdp; } else { throw new Exception( String.Format("The property value \"{0}\" is invalid or not present in RDP.Security.Protocol in ptfconfig", protocol)); } string strWaitTime = DetectorUtil.GetPropertyValue("WaitTime"); if (strWaitTime != null) { int waitTime = Int32.Parse(strWaitTime); timeout = new TimeSpan(0, 0, waitTime); } else { timeout = new TimeSpan(0, 0, 10); } return(true); }
/// <summary> /// Load configuration from PTF config file /// </summary> private void LoadConfiguation() { string tempStr; if (!PtfPropUtility.GetStringPtfProperty(Site, "RDP.ServerName", out serverName)) { AssumeFailForInvalidPtfProp("RDP.ServerName"); } if (PtfPropUtility.GetStringPtfProperty(Site, "RDP.ServerDomain", out tempStr)) { if (tempStr != null && tempStr.Length > 0) { this.domain = tempStr; } else { this.domain = this.serverName; } } if (!PtfPropUtility.GetIntPtfProperty(Site, "RDP.ServerPort", out serverPort)) { AssumeFailForInvalidPtfProp("RDP.ServerPort"); } if (!PtfPropUtility.GetStringPtfProperty(Site, "RDP.ServerUserName", out userName)) { AssumeFailForInvalidPtfProp("RDP.ServerUserName"); } if (!PtfPropUtility.GetStringPtfProperty(Site, "RDP.ServerUserPassword", out password)) { AssumeFailForInvalidPtfProp("RDP.ServerUserPassword"); } if (!PtfPropUtility.GetStringPtfProperty(Site, "RDP.ClientName", out localAddress)) { AssumeFailForInvalidPtfProp("RDP.ClientName"); } int waitTime; if (!PtfPropUtility.GetIntPtfProperty(Site, "Timeout", out waitTime)) { AssumeFailForInvalidPtfProp("Timeout"); } timeout = new TimeSpan(0, 0, waitTime); if (!PtfPropUtility.GetIntPtfProperty(Site, "MultiTransportTimeout", out waitTime)) { AssumeFailForInvalidPtfProp("MultiTransportTimeout"); } multiTransportTimeout = new TimeSpan(0, 0, waitTime); PtfPropUtility.GetBoolPtfProperty(Site, "IsWindowsImplementation", out isWindowsImplementation); PtfPropUtility.GetBoolPtfProperty(Site, "VerifyRdpbcgrMessages", out verifyPduEnabled); PtfPropUtility.GetBoolPtfProperty(Site, "VerifyShouldBehaviors", out verifyShouldBehaviors); PtfPropUtility.GetBoolPtfProperty(Site, "RDPEDYCSupported", out isEDYCSupported); PtfPropUtility.GetBoolPtfProperty(Site, "RDPELESupported", out isELESupported); PtfPropUtility.GetBoolPtfProperty(Site, "IssueTemporaryLicenseForTheFirstTime", out issueTemporaryLicenseForTheFirstTime); if (PtfPropUtility.GetStringPtfProperty(Site, "RDP.Version", out tempStr)) { rdpVersion = new Version(tempStr); } else { AssumeFailForInvalidPtfProp("RDP.Version"); } #region Security Approach and Protocol string strRDPSecurityProtocol; string strRDPSecurityTlsVersion; bool isNegotiationBased = true; if (!PtfPropUtility.GetBoolPtfProperty(Site, "RDP.Security.Negotiation", out isNegotiationBased)) { AssumeFailForInvalidPtfProp("RDP.Security.Negotiation"); } requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; if (!PtfPropUtility.GetStringPtfProperty(Site, "RDP.Security.Protocol", out strRDPSecurityProtocol)) { AssumeFailForInvalidPtfProp("RDP.Security.Protocol"); } //TLS, CredSSP, or RDP if (strRDPSecurityProtocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase)) { if (PtfPropUtility.GetStringPtfProperty(Site, "RDP.Security.TLS.Version", out strRDPSecurityTlsVersion)) { // TLS1.0, TLS1.1, TLS1.2 or None if (strRDPSecurityTlsVersion.Equals("TLS1.0", StringComparison.CurrentCultureIgnoreCase)) { tlsVersion = SslProtocols.Tls; } else if (strRDPSecurityTlsVersion.Equals("TLS1.1", StringComparison.CurrentCultureIgnoreCase)) { tlsVersion = SslProtocols.Tls11; } else if (strRDPSecurityTlsVersion.Equals("TLS1.2", StringComparison.CurrentCultureIgnoreCase)) { tlsVersion = SslProtocols.Tls12; } else if (strRDPSecurityTlsVersion.Equals("None", StringComparison.CurrentCultureIgnoreCase)) { tlsVersion = SslProtocols.None; } else { this.Site.Log.Add(LogEntryKind.Comment, "TLS is used as security protocol and the TLS Version is {0}.", strRDPSecurityTlsVersion); this.Site.Assume.Fail("When TLS is used as the security protocol, {0} must be one of TLS1.0, TLS1.1, or TLS1.2; actually it is set to {1}", "RDP.Security.TLS.Version", tlsVersion); } } else { AssumeFailForInvalidPtfProp("RDP.Security.TLS.Version"); } requestProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG; this.Site.Assume.IsTrue( isNegotiationBased, "When TLS is used as the security protocol, {0} is set to 'TLS', {1} must be true.", "RDP.Security.Protocol", "RDP.Security.Negotiation"); transportProtocol = EncryptedProtocol.NegotiationTls; } else if (strRDPSecurityProtocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG | requestedProtocols_Values.PROTOCOL_HYBRID_FLAG | requestedProtocols_Values.PROTOCOL_HYBRID_EX; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationCredSsp; } else { transportProtocol = EncryptedProtocol.DirectCredSsp; } } else if (strRDPSecurityProtocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; transportProtocol = EncryptedProtocol.Rdp; } else { AssumeFailForInvalidPtfProp("RDP.Security.Protocol"); } #endregion }
protected void triggerClientRDPConnect(EncryptedProtocol enProtocol, bool fullScreen = false) { int iResult = 0; string strMethod; if (enProtocol == EncryptedProtocol.Rdp || enProtocol == EncryptedProtocol.NegotiationCredSsp || enProtocol == EncryptedProtocol.NegotiationTls) { if (fullScreen) iResult = this.sutControlAdapter.RDPConnectWithNegotiationApproachFullScreen(); else iResult = this.sutControlAdapter.RDPConnectWithNegotiationApproach(); strMethod = "RDPConnectWithNegotiationApproach"; } else if (enProtocol == EncryptedProtocol.DirectCredSsp) { if (fullScreen) iResult = this.sutControlAdapter.RDPConnectWithDirectCredSSPFullScreen(); else iResult = this.sutControlAdapter.RDPConnectWithDirectCredSSP(); strMethod = "RDPConnectWithDirectCredSSP"; } else { if (fullScreen) iResult = this.sutControlAdapter.RDPConnectWithDirectTLSFullScreen(); else iResult = this.sutControlAdapter.RDPConnectWithDirectTLS(); strMethod = "RDPConnectWithDirectTLS"; } TestSite.Assume.IsTrue(iResult >= 0, "SUT Control Adapter: {0} should be successful: {1}.", strMethod, iResult); }
protected void LoadConfig() { #region Read and convert properties from PTFCONFIG file #region Security Approach and Protocol string strRDPSecurityProtocol; bool isNegotiationBased = true; if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityNegotiation, out isNegotiationBased)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityNegotiation); } selectedProtocol = selectedProtocols_Values.PROTOCOL_RDP_FLAG; if (!PtfPropUtility.GetStringPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityProtocol, out strRDPSecurityProtocol)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } else {//TLS, CredSSP, or RDP if (strRDPSecurityProtocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase)) { selectedProtocol = selectedProtocols_Values.PROTOCOL_SSL_FLAG; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationTls; } else { transportProtocol = EncryptedProtocol.DirectTls; } } else if (strRDPSecurityProtocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase)) { selectedProtocol = selectedProtocols_Values.PROTOCOL_HYBRID_FLAG; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationCredSsp; } else { transportProtocol = EncryptedProtocol.DirectCredSsp; } } else if (strRDPSecurityProtocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase)) { selectedProtocol = selectedProtocols_Values.PROTOCOL_RDP_FLAG; if (!isNegotiationBased) { this.TestSite.Log.Add(LogEntryKind.Warning, "The property \"RDP.Security.Protocol\" is not valid and will be ingored. (When use RDP as security protocol, the negotiation-based approch MUST be used."); } } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } } #endregion #region Encryption Level string strRDPSecurityEncryptionLevel; enLevel = EncryptionLevel.ENCRYPTION_LEVEL_LOW; if (!PtfPropUtility.GetStringPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityEncryptionLevel, out strRDPSecurityEncryptionLevel)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionLevel); } else {//None, Low, Client, High, FIPS if (strRDPSecurityEncryptionLevel.Equals("None", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_NONE; } else if (strRDPSecurityEncryptionLevel.Equals("Low", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_LOW; } else if (strRDPSecurityEncryptionLevel.Equals("Client", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; } else if (strRDPSecurityEncryptionLevel.Equals("High", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_HIGH; } else if (strRDPSecurityEncryptionLevel.Equals("FIPS", StringComparison.CurrentCultureIgnoreCase)) { enLevel = EncryptionLevel.ENCRYPTION_LEVEL_FIPS; } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionLevel); } } if (transportProtocol == EncryptedProtocol.Rdp && enLevel == EncryptionLevel.ENCRYPTION_LEVEL_NONE) { this.TestSite.Assert.Fail("When use Standard RDP Security, the encryption level must be greater than None."); } if (transportProtocol != EncryptedProtocol.Rdp && enLevel != EncryptionLevel.ENCRYPTION_LEVEL_NONE) { this.TestSite.Assert.Fail("When use enhanced security protocls (TLS or CredSSP), the encryption level MUST be None."); } #endregion #region Encryption Method string strRDPSecurityEncryptionMethod; enMethod = EncryptionMethods.ENCRYPTION_METHOD_128BIT; if (!PtfPropUtility.GetStringPtfProperty(TestSite, RdpPtfPropNames.RdpSecurityEncryptionMethod, out strRDPSecurityEncryptionMethod)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionMethod); } else {//None, 40bit, 56bit, 128bit, FIPS if (strRDPSecurityEncryptionMethod.Equals("None", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_NONE; } else if (strRDPSecurityEncryptionMethod.Equals("40bit", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_40BIT; } else if (strRDPSecurityEncryptionMethod.Equals("56bit", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_56BIT; } else if (strRDPSecurityEncryptionMethod.Equals("128bit", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_128BIT; } else if (strRDPSecurityEncryptionMethod.Equals("FIPS", StringComparison.CurrentCultureIgnoreCase)) { enMethod = EncryptionMethods.ENCRYPTION_METHOD_FIPS; } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityEncryptionMethod); } } if (enLevel == EncryptionLevel.ENCRYPTION_LEVEL_NONE && enMethod != EncryptionMethods.ENCRYPTION_METHOD_NONE) { this.TestSite.Assume.Fail("When Encryption Level is set to None, the Encryption Method should also set to None."); } if (enLevel == EncryptionLevel.ENCRYPTION_LEVEL_FIPS && enMethod != EncryptionMethods.ENCRYPTION_METHOD_FIPS) { this.TestSite.Assume.Fail("When Encryption Level is set to FIPS, the Encryption Method should also set to FIPS."); } #endregion #region RDP Version rdpServerVersion = TS_UD_SC_CORE_version_Values.V2; #endregion #region WaitTime int waitSeconds; if (!PtfPropUtility.GetIntPtfProperty(TestSite, RdpPtfPropNames.Timeout, out waitSeconds)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.Timeout); } else { waitTime = new TimeSpan(0, 0, waitSeconds); } #endregion #region SUT Display Verification if (!PtfPropUtility.GetBoolPtfProperty(TestSite, "VerifySUTDisplay.Enable", out verifySUTDisplay)) { verifySUTDisplay = false; } int shiftX, shiftY; if (!PtfPropUtility.GetIntPtfProperty(TestSite, "VerifySUTDisplay.Shift.X", out shiftX)) { shiftX = 0; } if (!PtfPropUtility.GetIntPtfProperty(TestSite, "VerifySUTDisplay.Shift.Y", out shiftY)) { shiftY = 0; } sutDisplayShift = new Point(shiftX, shiftY); if (!PtfPropUtility.GetStringPtfProperty(TestSite, "VerifySUTDisplay.BitmapSavePath", out bitmapSavePath)) { bitmapSavePath = @".\"; } // If the bitmap save path is not existed, create it. if (!Directory.Exists(bitmapSavePath)) { Directory.CreateDirectory(bitmapSavePath); } #endregion SUT Display Verification #region Other configrations if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportFastPathInput, out isClientSupportFastPathInput)) { isClientSupportFastPathInput = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportAutoReconnect, out isClientSuportAutoReconnect)) { isClientSuportAutoReconnect = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportRDPEFS, out isClientSupportRDPEFS)) { isClientSupportRDPEFS = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportServerRedirection, out isClientSupportServerRedirection)) { isClientSupportServerRedirection = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportSoftSync, out isClientSupportSoftSync)) { isClientSupportSoftSync = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportTunnelingStaticVCTraffic, out isClientSupportTunnelingStaticVCTraffic)) { isClientSupportTunnelingStaticVCTraffic = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, RdpPtfPropNames.RDPClientSupportRdpNegDataEmpty, out isClientSupportEmptyRdpNegData)) { isClientSupportEmptyRdpNegData = false; //if property not found, set to false as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, "IsWindowsImplementation", out isWindowsImplementation)) { isWindowsImplementation = true; //if property not found, set to true as default value } if (!PtfPropUtility.GetBoolPtfProperty(TestSite, "VerifyRdpbcgrMessage", out bVerifyRdpbcgrMessage)) { bVerifyRdpbcgrMessage = true; //if property not found, set to true as default value } String rdprfxImageFile; if (!PtfPropUtility.GetStringPtfProperty(TestSite, "RDPRFX.Image", out rdprfxImageFile)) { rdprfxImageFile = ""; //if property not found, set to true as default value } String rdprfxVideoModeImageFile; if (!PtfPropUtility.GetStringPtfProperty(TestSite, "RDPRFXVideoMode.Image", out rdprfxVideoModeImageFile)) { rdprfxVideoModeImageFile = ""; //if property not found, set to true as default value } try { //Get image from file image_64X64 = Image.FromFile(rdprfxImageFile); imageForVideoMode = Image.FromFile(rdprfxVideoModeImageFile); } catch (System.IO.FileNotFoundException) { //capture screen if failed to get image from file //Capture 64*64 bitmap for Image Mode image_64X64 = captureScreenImage(0, 0, TileSize, TileSize); //Capture screen bitmap for Vedio Mode imageForVideoMode = captureScreenImage(0, 0, TileSize * VideoMode_TileRowNum, TileSize * VideoMode_TileColNum); } #endregion #endregion #region Logging this.TestSite.Log.Add(LogEntryKind.Debug, @"isClientSupportFastPathInput = {0}; isClientSuportAutoReconnect = {1}; isClientSupportRDPEFS = {2}; isClientSupportServerRedirection = {3}; isClientSupportEmptyRdpNegData = {4}; isClientSupportSoftSync = {5} isClientSupportTunnelingStaticVCTraffic = {6}", isClientSupportFastPathInput, isClientSuportAutoReconnect, isClientSupportRDPEFS, isClientSupportServerRedirection, isClientSupportEmptyRdpNegData, isClientSupportSoftSync, isClientSupportTunnelingStaticVCTraffic); #endregion }
protected void LoadConfig() { #region Security Approach and Protocol string strRDPSecurityProtocol; bool isNegotiationBased = true; if (!PtfPropUtility.GetBoolPtfProperty(Site, RdpPtfPropNames.RdpSecurityNegotiation, out isNegotiationBased)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityNegotiation); } requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; if (!PtfPropUtility.GetStringPtfProperty(Site, RdpPtfPropNames.RdpSecurityProtocol, out strRDPSecurityProtocol)) { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } else {//TLS, CredSSP, or RDP if (strRDPSecurityProtocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG; this.Site.Assume.IsTrue( isNegotiationBased, "When TLS is used as the security protocol, {0} is set to 'TLS', {1} must be true.", RdpPtfPropNames.RdpSecurityProtocol, RdpPtfPropNames.RdpSecurityNegotiation); transportProtocol = EncryptedProtocol.NegotiationTls; string strTlsVersion; if (PtfPropUtility.GetStringPtfProperty(Site, RdpPtfPropNames.RdpSecurityTlsVersion, out strTlsVersion)) { if (!strTlsVersion.Equals("TLS1.0", StringComparison.CurrentCultureIgnoreCase) && !strTlsVersion.Equals("TLS1.1", StringComparison.CurrentCultureIgnoreCase) && !strTlsVersion.Equals("TLS1.2", StringComparison.CurrentCultureIgnoreCase)) { this.Site.Assume.Fail("When TLS is used as the security protocol, {0} must be one of TLS1.0, TLS1.1, or TLS1.2; actually it is set to {1}", RdpPtfPropNames.RdpSecurityTlsVersion, strTlsVersion); } else { this.Site.Log.Add(LogEntryKind.Comment, "TLS is used as security protocol and the TLS Version is {0}.", strTlsVersion); } } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityTlsVersion); } } else if (strRDPSecurityProtocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_HYBRID_FLAG; if (isNegotiationBased) { transportProtocol = EncryptedProtocol.NegotiationCredSsp; } else { transportProtocol = EncryptedProtocol.DirectCredSsp; } } else if (strRDPSecurityProtocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase)) { requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG; transportProtocol = EncryptedProtocol.Rdp; } else { assumeFailForInvalidPtfProp(RdpPtfPropNames.RdpSecurityProtocol); } } #region Is Windows Implementation string strIsWindows = Site.Properties["IsWindowsImplementation"]; if (strIsWindows != null) { isWindowsImplementation = Boolean.Parse(strIsWindows); } #endregion #region WaitTime string strWaitTime = Site.Properties["WaitTime"]; if (strWaitTime != null) { int waitSeconds = Int32.Parse(strWaitTime); timeout = new TimeSpan(0, 0, waitSeconds); } #endregion #endregion string rdpVersionProp = this.Site.Properties["RDP.Version"]; if (!string.IsNullOrEmpty(rdpVersionProp)) { rdpVersion = new Version(rdpVersionProp); } else { this.Site.Assume.Fail("The property \"{0}\" is invalid or not present in PTFConfig file!", "RDP.Version"); } }
public static void LoadConfig(ITestSite site) { Timeout = TimeSpan.FromSeconds(CommonUtility.GetIntProperty(site, ConfigPropNames.Timeout)); IsWindowsImplementation = CommonUtility.GetBoolProperty(site, ConfigPropNames.IsWindowsImplementation); IsNegotiationBased = CommonUtility.GetBoolProperty(site, ConfigPropNames.RdpSecurityNegotiation); RdpSecurityProtocolValues rsp = CommonUtility.GetEnumProperty<RdpSecurityProtocolValues>(site, ConfigPropNames.RdpSecurityProtocol); switch (rsp) { case RdpSecurityProtocolValues.TLS: SelectedProtocol = selectedProtocols_Values.PROTOCOL_SSL_FLAG; TransportProtocol = IsNegotiationBased ? EncryptedProtocol.NegotiationTls : EncryptedProtocol.DirectTls; break; case RdpSecurityProtocolValues.CredSSP: SelectedProtocol = selectedProtocols_Values.PROTOCOL_HYBRID_FLAG; TransportProtocol = IsNegotiationBased ? EncryptedProtocol.NegotiationCredSsp : EncryptedProtocol.DirectCredSsp; break; case RdpSecurityProtocolValues.RDP: SelectedProtocol = selectedProtocols_Values.PROTOCOL_RDP_FLAG; site.Assume.IsTrue( IsNegotiationBased, "When RDP is used as the security protocol, {0} is set to 'RDP', {1} must be true.", ConfigPropNames.RdpSecurityProtocol, ConfigPropNames.RdpSecurityNegotiation); TransportProtocol = EncryptedProtocol.Rdp; break; default: site.Assume.Fail("The property '{0}' is not valid, it must be set to one of TLS, CredSSP or RDP.", ConfigPropNames.RdpSecurityProtocol); break; } EncryptionLevelValues ev = CommonUtility.GetEnumProperty<EncryptionLevelValues>(site, ConfigPropNames.RdpSecurityEncryptionLevel); switch (ev) { case EncryptionLevelValues.None: EncLevel = EncryptionLevel.ENCRYPTION_LEVEL_NONE; break; case EncryptionLevelValues.Low: EncLevel = EncryptionLevel.ENCRYPTION_LEVEL_LOW; break; case EncryptionLevelValues.Client: EncLevel = EncryptionLevel.ENCRYPTION_LEVEL_CLIENT_COMPATIBLE; break; case EncryptionLevelValues.High: EncLevel = EncryptionLevel.ENCRYPTION_LEVEL_HIGH; break; case EncryptionLevelValues.FIPS: EncLevel = EncryptionLevel.ENCRYPTION_LEVEL_FIPS; break; default: site.Assume.Fail("The property '{0}' is not valid, it MUST be one of None, Low, Client, High, FIPS.", ConfigPropNames.RdpSecurityEncryptionLevel); break; } Dictionary<string, EncryptionMethods> encMethodValues = new Dictionary<string, EncryptionMethods>(); encMethodValues.Add("None", EncryptionMethods.ENCRYPTION_METHOD_NONE); encMethodValues.Add("40bit", EncryptionMethods.ENCRYPTION_METHOD_40BIT); encMethodValues.Add("56bit", EncryptionMethods.ENCRYPTION_METHOD_56BIT); encMethodValues.Add("128bit", EncryptionMethods.ENCRYPTION_METHOD_128BIT); encMethodValues.Add("FIPS", EncryptionMethods.ENCRYPTION_METHOD_FIPS); string str = CommonUtility.GetProperty(site, ConfigPropNames.RdpSecurityEncryptionMethod); site.Assume.IsTrue( encMethodValues.ContainsKey(str), "The property '{0}' must be 'None', '40bit', '56bit', '128bit', or 'FIPS'.", ConfigPropNames.RdpSecurityEncryptionMethod); EncMethod = encMethodValues[str]; RdpVersion = TS_UD_SC_CORE_version_Values.V2; ValidateConfig(site.Assume); }