public ucPropertyEditor(IDataSourceManager dataSourceManager, Dictionary <string, string> props) { InitializeComponent(); DataSourceManager = dataSourceManager; List <string> propNames = new List <string>(); foreach (IDataSourceFactory ds in DataSourceManager.DataSourceFactories) { List <IProperty> properties = ds.ConnectionProperties; IProperty propSettings = GetPropertyByName(properties, Constants.PropertySettingName); if (propSettings != null && propSettings.Value == Constants.PropertySettingUseGlobal) { foreach (IProperty p in properties) { if (p.Name != Constants.PropertySettingName && !propNames.Contains(p.Name)) { ConnectionProperties.Add(p); propNames.Add(p.Name); if (props.ContainsKey(p.Name)) { p.Value = props[p.Name]; } } } } } roundedPanel2.Visible = false; roundedPanel3.Visible = false; PasswordChar = '\0'; }
internal virtual IConnectionProperties?CreateListenerProperties() { if (!UseSsl) { return(null); } var properties = new ConnectionProperties(); properties.Add(SslConnectionFactory.SslServerAuthenticationOptionsPropertyKey, new SslServerAuthenticationOptions { ServerCertificate = TestCertificates.GetSelfSigned13ServerCertificate() }); return(properties); }
internal virtual IConnectionProperties?CreateConnectProperties() { if (!UseSsl) { return(null); } var properties = new ConnectionProperties(); properties.Add(SslConnectionFactory.SslClientAuthenticationOptionsPropertyKey, new SslClientAuthenticationOptions { RemoteCertificateValidationCallback = delegate { return(true); }, TargetHost = "localhost" }); return(properties); }
public async Task Connect_SelfSigned_Success() { var protocols = new List <SslApplicationProtocol> { new SslApplicationProtocol("test") }; var connectProperties = new ConnectionProperties(); connectProperties.Add(SslConnectionFactory.SslClientAuthenticationOptionsPropertyKey, new SslClientAuthenticationOptions { TargetHost = "localhost", ApplicationProtocols = protocols, RemoteCertificateValidationCallback = delegate { return(true); } }); var listenProperties = new ConnectionProperties(); listenProperties.Add(SslConnectionFactory.SslServerAuthenticationOptionsPropertyKey, new SslServerAuthenticationOptions { ApplicationProtocols = protocols, ServerCertificate = TestCertificates.GetSelfSigned13ServerCertificate() }); byte[] sendBuffer = Encoding.ASCII.GetBytes("Testing 123"); await using ConnectionFactory factory = new SslConnectionFactory(new MemoryConnectionFactory()); await using ConnectionListener listener = await factory.ListenAsync(options : listenProperties); await RunClientServer( async() => { await using Connection connection = await factory.ConnectAsync(listener.EndPoint !, connectProperties); await connection.Stream.WriteAsync(sendBuffer); }, async() => { await using Connection? connection = await listener.AcceptConnectionAsync(); Assert.NotNull(connection); Debug.Assert(connection != null); byte[] buffer = new byte[sendBuffer.Length + 1]; int readLen = await connection.Stream.ReadAsync(buffer); Assert.Equal(sendBuffer, buffer[..readLen]);