'  
'   Rebex Sample Code License
' 
'   Copyright 2026, REBEX CR s.r.o.
'   All rights reserved.
'   https://www.rebex.net/
' 
'   Permission to use, copy, modify, and/or distribute this software for any
'   purpose with or without fee is hereby granted.
' 
'   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
'   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
'   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
'   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
'   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
'   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
'   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
'   OTHER DEALINGS IN THE SOFTWARE.
' 

Imports System.Collections
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Security.Cryptography.X509Certificates
Imports System.Windows.Forms
Imports Rebex.Net
Imports Rebex.Security.Certificates

Public Class UcConnectionEditor
    Inherits UserControl
#Region "Private variables"

    ''' <summary>
    ''' A mode "before selection has changed" is remembered here
    ''' </summary>
    Private _previousMode As FileTransferMode

#End Region

#Region "Events"

    ''' <summary>
    ''' Occurs when height of inner controls has been recalculated according to current visibility of their content.
    ''' </summary>        
    <Description("Occurs when height of inner controls has been recalculated according to current visibility of their content.")> _
    Public Event HeightRecalculated As EventHandler

    ''' <summary>
    ''' Occurs when rearranging within some inner control starts.<br/>
    ''' Can be used as an extension point for adding new inner controls to the sender.
    ''' </summary>
    Protected Event ControlsRearranging As EventHandler

    ''' <summary>
    ''' Occurs when rearranging within some inner control is finished.<br/>
    ''' Can be used as an extension point for adding new inner controls to the sender.
    ''' </summary>
    Protected Event ControlsRearranged As EventHandler

#End Region

#Region "Ctor"
    Public Sub New()
        InitializeComponent()

        ' design-time bining should be done in ctor (regardless filtering)
        If LicenseManager.UsageMode = LicenseUsageMode.Designtime Then
            BindComboBoxes()
        End If
    End Sub
#End Region

#Region "Field values properties"

#Region "Connection"

    ''' <summary>
    ''' Gets or sets server host address.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property ServerHost() As String
        Get
            Return tbServerHost.Text
        End Get
        Set(value As String)
            tbServerHost.Text = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets server port.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property ServerPort() As Integer
        Get
            Dim ret As Integer = 0
            Integer.TryParse(tbServerPort.Text, ret)
            Return ret
        End Get
        Set(value As Integer)
            tbServerPort.Text = ""
            If (value <> 0) Then
                tbServerPort.Text = value.ToString()
            End If
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets used file transfer protocol mode.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property FileTransferMode() As FileTransferMode
        Get
            ' if nothing is selected...
            If cmbProtocol.SelectedValue Is Nothing Then
                cmbProtocol.SelectedIndex = 0
            End If
            ' ... select the first item
            Return CType(cmbProtocol.SelectedValue, FileTransferMode)
        End Get
        Set(value As FileTransferMode)
            cmbProtocol.SelectedValue = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets passive mode.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property PassiveMode() As Boolean
        Get
            Return cbPassive.Checked
        End Get
        Set(value As Boolean)
            cbPassive.Checked = value
        End Set
    End Property

#End Region

#Region "Credentials"

    ''' <summary>
    ''' Gets or sets server login name.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property ServerUser() As String
        Get
            Return tbServerUser.Text
        End Get
        Set(value As String)
            tbServerUser.Text = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets server login password.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property ServerPassword() As String
        Get
            Return tbServerPassword.Text
        End Get
        Set(value As String)
            tbServerPassword.Text = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets server login domain (used for Gss Api).
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property ServerDomain() As String
        Get
            Return tbServerDomain.Text
        End Get
        Set(value As String)
            tbServerDomain.Text = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets private key used for SSH authentization.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property PrivateKey() As SshPrivateKey
        Get
            Return _privateKey
        End Get
        Set(value As SshPrivateKey)
            _privateKey = value
            RefreshPrivateKeyField()
        End Set
    End Property
    Private _privateKey As SshPrivateKey = Nothing

    ''' <summary>
    ''' Gets or sets private key filename used to load a private key for SSH authentization.
    ''' </summary>
    <Browsable(True)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property PrivateKeyFilename() As String
        Get
            Return _privateKeyFilename
        End Get
        Set(value As String)
            _privateKeyFilename = value
            RefreshPrivateKeyField()
        End Set
    End Property

    Private _privateKeyFilename As String = ""

    ''' <summary>
    ''' Gets or sets client certificate used for SSL authentization.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property ClientCertificate() As CertificateChain
        Get
            Return _clientCertificate
        End Get
        Set(value As CertificateChain)
            _clientCertificate = value
            RefreshClientCertificateField()
        End Set
    End Property
    Private _clientCertificate As CertificateChain = Nothing
    Private WithEvents panel1 As System.Windows.Forms.Panel
    Private WithEvents cmbSuites As System.Windows.Forms.ComboBox
    Private WithEvents cbAllowTls13 As System.Windows.Forms.CheckBox
    Private WithEvents cbAllowTls12 As System.Windows.Forms.CheckBox
    Private WithEvents cbAllowTls11 As System.Windows.Forms.CheckBox
    Private WithEvents cbAllowTls10 As System.Windows.Forms.CheckBox
    Private WithEvents label23 As System.Windows.Forms.Label
    Private WithEvents label22 As System.Windows.Forms.Label
    Private WithEvents cmbSshSuites As ComboBox
    Private WithEvents Label24 As Label

    ''' <summary>
    ''' Gets or sets private key filename used to load a private key for SSH authentization.
    ''' </summary>
    <Browsable(True)>
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property ClientCertificateFilename() As String
        Get
            Return _clientCertificateFilename
        End Get
        Set(value As String)
            _clientCertificateFilename = value
            RefreshClientCertificateField()
        End Set
    End Property
    Private _clientCertificateFilename As String = Nothing

    ''' <summary>
    ''' Gets or sets a value, indicating whether the password can be persisted to a file (outside the control). 
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property StorePassword() As Boolean
        Get
            Return cbStorePassword.Checked
        End Get
        Set(value As Boolean)
            cbStorePassword.Checked = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets GSS API mode.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property UseGssApi() As Boolean
        Get
            Return cbUseGssApi.Checked
        End Get
        Set(value As Boolean)
            cbUseGssApi.Checked = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets Clear Command Channel mode.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ClearCommandChannel() As Boolean
        Get
            Return cbClearCommandChannel.Checked
        End Get
        Set(value As Boolean)
            cbClearCommandChannel.Checked = value
        End Set
    End Property

#End Region

#Region "Proxy"

    ''' <summary>
    ''' Gets or sets used proxy type (or <see cref="FileTransferProxyType.None"/> when no proxy is used).
    ''' </summary>
    ''' <remarks>
    ''' We have to use generalized enum <see cref="FileTransferProxyType"/> since e.g. specialized FtpProxyType 
    ''' is declared in Rebex.Ftp assembly and that assembly would not be available even when using this user control.<br/>
    ''' Fortunately, int values of the FtpProxyType are compatible with the <see cref="FileTransferProxyType"/> 
    ''' and int values of the ProxyType (used in Sftp) are a subset of the <see cref="FileTransferProxyType"/>.
    ''' </remarks>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ProxyType() As FileTransferProxyType
        Get
            ' if nothing is selected...
            If cmbProxyType.SelectedValue Is Nothing Then
                If cmbProxyType.Items Is Nothing OrElse cmbProxyType.Items.Count <= 0 Then
                    Return FileTransferProxyType.None
                End If
                ' ... and nothing can be selected -> just return the default
                ' ... and something can be selected -> select the first item as a side effect
                cmbProxyType.SelectedIndex = 0
            End If
            Return CType(cmbProxyType.SelectedValue, FileTransferProxyType)
        End Get
        Set(value As FileTransferProxyType)
            cmbProxyType.SelectedValue = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets proxy host address.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ProxyHost() As String
        Get
            Return tbProxyHost.Text
        End Get
        Set(value As String)
            tbProxyHost.Text = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets proxy port.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ProxyPort() As Integer
        Get
            Dim ret As Integer = 0
            Integer.TryParse(tbProxyPort.Text, ret)
            Return ret
        End Get
        Set(value As Integer)
            tbProxyPort.Text = ""
            If value <> 0 Then
                tbProxyPort.Text = value.ToString()
            End If
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets proxy login name.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ProxyUser() As String
        Get
            Return tbProxyUsername.Text
        End Get
        Set(value As String)
            tbProxyUsername.Text = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets proxy login password.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ProxyPassword() As String
        Get
            Return tbProxyPassword.Text
        End Get
        Set(value As String)
            tbProxyPassword.Text = value
        End Set
    End Property

#End Region

#Region "SSL specifics"

    ''' <summary>
    ''' Gets or sets hash value used for validating SSL server certificate 
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ServerCertificateVerifyingMode() As CertificateVerifyingMode
        Get
            If rbServerCertificateAny.Checked Then
                Return CertificateVerifyingMode.AcceptAnyCertificate
            End If
            If rbServerCertificateWindows.Checked Then
                Return CertificateVerifyingMode.UseWindowsInfrastructure
            End If
            If rbServerCertificateStored.Checked Then
                Return CertificateVerifyingMode.LocalyStoredThumbprint
            End If
            If LicenseManager.UsageMode = LicenseUsageMode.Designtime Then
                Return CType(0, CertificateVerifyingMode)
            End If
            ' whe should not throw exception in design time - let's return some invalid value instead
            Throw New InvalidOperationException("No CertfificateVerifyingMode has been choosen.")
        End Get
        Set(value As CertificateVerifyingMode)
            Select Case value
                Case CertificateVerifyingMode.AcceptAnyCertificate
                    rbServerCertificateAny.Checked = True
                    Exit Select
                Case CertificateVerifyingMode.UseWindowsInfrastructure
                    rbServerCertificateWindows.Checked = True
                    Exit Select
                Case CertificateVerifyingMode.LocalyStoredThumbprint
                    rbServerCertificateStored.Checked = True
                    Exit Select
                Case Else
                    Throw New InvalidOperationException(String.Format("Unexpected enum value '{0}'", value))
            End Select
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets hash value used for validating SSL server certificate 
    ''' (when <see cref="ServerCertificateVerifyingMode"/> is <c>LocalyStoredThumbprint</c>).
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ServerCertificateThumbprint() As String
        Get
            Return tbServerCertificateThumbprint.Text
        End Get
        Set(value As String)
            tbServerCertificateThumbprint.Text = value
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets TLS/SSL protocol version.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property Protocol() As TlsVersion
        Get
            Dim version As TlsVersion = TlsVersion.None
            If cbAllowTls13.Checked Then version = version Or TlsVersion.TLS13
            If cbAllowTls12.Checked Then version = version Or TlsVersion.TLS12
            If cbAllowTls11.Checked Then version = version Or TlsVersion.TLS11
            If cbAllowTls10.Checked Then version = version Or TlsVersion.TLS10
            Return version
        End Get
        Set(ByVal Value As TlsVersion)
            cbAllowTls13.Checked = (Value And TlsVersion.TLS13) <> 0
            cbAllowTls12.Checked = (Value And TlsVersion.TLS12) <> 0
            cbAllowTls11.Checked = (Value And TlsVersion.TLS11) <> 0
            cbAllowTls10.Checked = (Value And TlsVersion.TLS10) <> 0
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets allowed secure suites.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property AllowedSuite As TlsCipherSuite
        Get
            If cmbSuites.SelectedIndex = 0 Then
                Return TlsCipherSuite.All
            Else
                Return TlsCipherSuite.Secure
            End If
        End Get
        Set(value As TlsCipherSuite)
            If value = TlsCipherSuite.All Then
                cmbSuites.SelectedIndex = 0
            Else
                cmbSuites.SelectedIndex = 1
            End If
        End Set
    End Property

#End Region

#Region "SSH specifics"

    ''' <summary>
    ''' Gets or sets fingerprint used for validating SSH server key
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ServerKeyVerifyingMode() As KeyVerifyingMode
        Get
            If rbServerKeyAny.Checked Then
                Return KeyVerifyingMode.AcceptAnyKey
            End If
            If rbServerKeyStored.Checked Then
                Return KeyVerifyingMode.LocalyStoredFingerprint
            End If
            If LicenseManager.UsageMode = LicenseUsageMode.Designtime Then
                Return CType(0, KeyVerifyingMode)
            End If
            ' we should not throw an exception in design time - let's return some invalid value instead
            Throw New InvalidOperationException("No KeyVerifyingMode has been chosen.")
        End Get
        Set(value As KeyVerifyingMode)
            Select Case value
                Case KeyVerifyingMode.AcceptAnyKey
                    rbServerKeyAny.Checked = True
                    Exit Select
                Case KeyVerifyingMode.LocalyStoredFingerprint
                    rbServerKeyStored.Checked = True
                    Exit Select
                Case Else
                    Throw New InvalidOperationException(String.Format("Unexpected enum value '{0}'", value))
            End Select
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets algorithm for server key used for verifying <see cref="ServerKeyFingerprint"/>
    ''' (when <see cref="ServerKeyVerifyingMode"/> is <c>LocalyStoredFingerprint</c>).
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ServerKeyAlgorithm() As SshHostKeyAlgorithm
        Get
            ' if nothing is selected...
            If cmbServerKeyAlgorithm.SelectedValue Is Nothing Then
                If cmbServerKeyAlgorithm.Items.Count <= 0 Then
                    Return SshHostKeyAlgorithm.None
                End If
                ' ... select the first item
                cmbServerKeyAlgorithm.SelectedIndex = 0
            End If
            Return CType(cmbServerKeyAlgorithm.SelectedValue, SshHostKeyAlgorithm)
        End Get
        Set(value As SshHostKeyAlgorithm)
            cmbServerKeyAlgorithm.SelectedValue = value
        End Set
    End Property

    ''' <summary>
    ''' Gets Or sets allowed secure suites.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property AllowWeakSuites() As Boolean
        Get
            If (cmbSshSuites.SelectedIndex = 0) Then
                Return True
            Else
                Return False
            End If
        End Get
        Set
            If (Value) Then
                cmbSshSuites.SelectedIndex = 0
            Else
                cmbSshSuites.SelectedIndex = 1
            End If
        End Set
    End Property

    ''' <summary>
    ''' Gets or sets hash algorithm used for <see cref="ServerKeyFingerprint"/>
    ''' (when <see cref="ServerKeyVerifyingMode"/> is <c>LocalyStoredFingerprint</c>).
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ServerKeyHashAlgorithm() As SignatureHashAlgorithm
        Get
            ' if nothing is selected...
            If cmbServerKeyHashAlgorithm.SelectedValue Is Nothing Then
                If cmbServerKeyHashAlgorithm.Items.Count <= 0 Then
                    Return SignatureHashAlgorithm.Unsupported
                End If
                ' ... select the first item
                cmbServerKeyHashAlgorithm.SelectedIndex = 0
            End If
            Return CType(cmbServerKeyHashAlgorithm.SelectedValue, SignatureHashAlgorithm)
        End Get
        Set(value As SignatureHashAlgorithm)
            cmbServerKeyHashAlgorithm.SelectedValue = value
        End Set
    End Property


    ''' <summary>
    ''' Gets or sets fingerprint used for validating SSH server key
    ''' (when <see cref="ServerKeyVerifyingMode"/> is <c>LocalyStoredFingerprint</c>).
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property ServerKeyFingerprint() As String
        Get
            Return tbServerKeyFingerprint.Text
        End Get
        Set(value As String)
            tbServerKeyFingerprint.Text = value
        End Set
    End Property

#End Region

#Region "Transform from/to ConnectionData"

    Public Sub GetData(data As ConnectionData)
        If data Is Nothing Then
            Throw New ArgumentNullException("data")
        End If

        data.ClearCommandChannel = ClearCommandChannel
        data.ClientCertificate = ClientCertificate
        data.ClientCertificateFilename = ClientCertificateFilename
        data.PassiveMode = PassiveMode
        data.PrivateKey = PrivateKey
        data.PrivateKeyFilename = PrivateKeyFilename
        data.ProxyHost = ProxyHost
        data.ProxyPassword = ProxyPassword
        data.ProxyPort = ProxyPort
        data.ProxyType = ProxyType
        data.ProxyUser = ProxyUser
        data.FileTransferMode = FileTransferMode
        data.ServerCertificateThumbprint = ServerCertificateThumbprint
        data.ServerCertificateVerifyingMode = ServerCertificateVerifyingMode
        data.ServerDomain = ServerDomain
        data.ServerHost = ServerHost
        data.ServerKeyAlgorithm = ServerKeyAlgorithm
        data.ServerKeyFingerprint = ServerKeyFingerprint
        data.ServerKeyHashAlgorithm = ServerKeyHashAlgorithm
        data.ServerKeyVerifyingMode = ServerKeyVerifyingMode
        data.ServerPassword = ServerPassword
        data.ServerPort = ServerPort
        data.ServerUser = ServerUser
        data.StorePassword = StorePassword
        data.UseGssApi = UseGssApi
        data.TlsProtocol = Protocol
        data.AllowedSuite = AllowedSuite
        data.AllowWeakSuites = AllowWeakSuites
    End Sub

    Public Sub SetData(data As ConnectionData)
        If data Is Nothing Then
            Throw New ArgumentNullException("data")
        End If

        FileTransferMode = data.FileTransferMode

        ServerHost = data.ServerHost
        ServerPort = data.ServerPort
        ServerPassword = data.ServerPassword
        ServerUser = data.ServerUser

        ClearCommandChannel = data.ClearCommandChannel
        PassiveMode = data.PassiveMode

        UseGssApi = data.UseGssApi
        ServerDomain = data.ServerDomain

        PrivateKey = data.PrivateKey
        PrivateKeyFilename = data.PrivateKeyFilename

        ProxyHost = data.ProxyHost
        ProxyPassword = data.ProxyPassword
        ProxyPort = data.ProxyPort
        ProxyType = data.ProxyType
        ProxyUser = data.ProxyUser

        ServerKeyVerifyingMode = data.ServerKeyVerifyingMode
        ServerKeyAlgorithm = data.ServerKeyAlgorithm
        ServerKeyHashAlgorithm = data.ServerKeyHashAlgorithm
        ServerKeyFingerprint = data.ServerKeyFingerprint

        ServerCertificateVerifyingMode = data.ServerCertificateVerifyingMode
        ServerCertificateThumbprint = data.ServerCertificateThumbprint

        ClientCertificate = data.ClientCertificate
        ClientCertificateFilename = data.ClientCertificateFilename

        StorePassword = data.StorePassword

        AllowedSuite = data.AllowedSuite
        AllowWeakSuites = data.AllowWeakSuites

        Protocol = data.TlsProtocol
    End Sub

#End Region

#End Region

#Region "Visibility and accessibility properties"

    ''' <summary>
    ''' Gets or sets information, whether controls and values used for FTP or FTP/SSL specific settings should be hidden.<br/>
    ''' NOTE: Value does not affect controls directly, it is processed just once when initializing this user control.
    ''' </summary>
    <Description("Hide controls and values used for FTP or FTP/SSL specific settings. (used when working in SFTP-only mode)")>
    <DefaultValue(False)>
    Public Property HideFtpGui() As Boolean
        Get
            Return _hideFtpGui
        End Get
        Set(value As Boolean)
            _hideFtpGui = value
        End Set
    End Property
    Private _hideFtpGui As Boolean

    ''' <summary>
    ''' Gets or sets information, whether controls and values used for SFTP specific settings should be hidden.<br/>
    ''' NOTE: Value does not affect controls directly, it is processed just once when initializing this user control.
    ''' </summary>
    <Description("Hide controls and values used for SFTP specific settings. (used when working in FTP-only mode)")>
    <DefaultValue(False)>
    Public Property HideSftpGui() As Boolean
        Get
            Return _hideSftpGui
        End Get
        Set(value As Boolean)
            _hideSftpGui = value
        End Set
    End Property
    Private _hideSftpGui As Boolean

    ''' <summary>
    ''' Gets information, whether checkbox "Passive mode" is currenty enabled.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property IsPassiveEnabled() As Boolean
        Get
            Return FileTransferMode <> FileTransferMode.Sftp
        End Get
    End Property

    ''' <summary>
    ''' Gets information, whether GUI for settings of SFTP private key is currenty enabled.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property IsPrivateKeyEnabled() As Boolean
        Get
            Return FileTransferMode = FileTransferMode.Sftp
        End Get
    End Property

    ''' <summary>
    ''' Gets information, whether GUI for settings of SSL client certificate is currenty enabled.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property IsClientCertificateEnabled() As Boolean
        Get
            Return FileTransferMode = FileTransferMode.FtpSslExplicit OrElse FileTransferMode = FileTransferMode.FtpSslImplicit OrElse FileTransferMode = FileTransferMode.Sftp
        End Get
    End Property

    ''' <summary>
    ''' Gets information, whether checkbox "Use GSS API" is currenty enabled.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property IsUseGssApiEnabled() As Boolean
        Get
            Return FileTransferMode = FileTransferMode.Sftp
        End Get
    End Property

    ''' <summary>
    ''' Gets information, whether checkbox "Clear Command Channel" is currenty enabled.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property IsClearCommandChannelEnabled() As Boolean
        Get
            Return FileTransferMode = FileTransferMode.FtpSslExplicit OrElse FileTransferMode = FileTransferMode.FtpSslImplicit
        End Get
    End Property

    ''' <summary>
    ''' Gets information, whether the SSH tab is currenty enabled.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property IsSshTabEnabled() As Boolean
        Get
            Return FileTransferMode = FileTransferMode.Sftp
        End Get
    End Property

    ''' <summary>
    ''' Gets information, whether the SSL tab is currenty enabled.
    ''' </summary>
    <Browsable(False)> _
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public ReadOnly Property IsSslTabEnabled() As Boolean
        Get
            Return FileTransferMode = FileTransferMode.FtpSslExplicit OrElse FileTransferMode = FileTransferMode.FtpSslImplicit
        End Get
    End Property

#End Region

#Region "Validation"

    ''' <summary>
    ''' Validates all static rules. Returns collection of errors.
    ''' </summary>
    ''' <returns>Collection of error messages or empty collection on success.</returns>
    Public Function GetValidationErrors() As List(Of String)
        Dim errors As New List(Of String)()

        If String.IsNullOrEmpty(ServerHost) Then
            errors.Add("Server host name is a required field.")
        End If
        If ServerPort <= 0 Then
            errors.Add("Server port is a required non-zero field.")
        End If

        If ProxyType <> FileTransferProxyType.None Then
            If String.IsNullOrEmpty(ProxyHost) Then
                errors.Add("Proxy host name is a required field.")
            End If
            If ProxyPort <= 0 Then
                errors.Add("Proxy port is a required non-zero field.")
            End If

            If FileTransferMode = FileTransferMode.FtpSslExplicit OrElse FileTransferMode = FileTransferMode.FtpSslImplicit Then
                Dim proxyWhenSecure As FileTransferProxyType() = New FileTransferProxyType() {FileTransferProxyType.Socks4, FileTransferProxyType.Socks4a, FileTransferProxyType.Socks5, FileTransferProxyType.HttpConnect}
                Dim ok As Boolean = False

                For i As Integer = 0 To proxyWhenSecure.Length - 1
                    If proxyWhenSecure(i) = ProxyType Then
                        ok = True
                    End If
                Next

                If Not ok Then
                    errors.Add("This proxy type is not allowed when using SSL.")
                End If

            End If
        End If

        If (PrivateKey IsNot Nothing OrElse Not String.IsNullOrEmpty(PrivateKeyFilename)) AndAlso (ClientCertificate IsNot Nothing OrElse Not String.IsNullOrEmpty(ClientCertificateFilename)) Then
            errors.Add("Private key and Client certificate cannot be used together.")
        End If

        Return errors
    End Function

#End Region

#Region "GUI behavior methods"

    ''' <summary>
    ''' Recomputes visibility of inner controls and values according to <see cref="HideFtpGui"/> and <see cref="HideSftpGui"/>,
    ''' then removes all invisible controls from this user control 
    ''' and adjusts height both of the user control and of the parent form where the user control is placed in.
    ''' </summary>
    Public Sub AdaptToCurrentVisibility()
        ' don't execute this method in design-time
        If LicenseManager.UsageMode = LicenseUsageMode.Designtime Then
            Return
        End If

        RecalculateProtocolSpecificVisibility()

        BindComboBoxes()

        RecomputeProtocolSpecificFields()

        If ParentForm Is Nothing Then
            Throw New InvalidOperationException("AdaptToCurrentVisibility can be called only if the user control is placed into some ParentForm.")
        End If

        ' store current anchor settings and clear bottom and right anchor (that anchors would mess-up the resizing)
        Dim origAnchor As AnchorStyles = Anchor
        Anchor = AnchorStyles.Left Or AnchorStyles.Top

        Dim heightDelta As Integer = ParentForm.Height - Height
        RearrangeVisibleControls()

        ParentForm.Size = New Size(ParentForm.Width, Height + heightDelta)
        ParentForm.MinimumSize = New Size(ParentForm.MinimumSize.Width, ParentForm.Height)

        Anchor = origAnchor
    End Sub

    ''' <summary>
    ''' Fill lists in combo boxes
    ''' </summary>
    Private Sub BindComboBoxes()
        ' cmbProtocol
        Dim protoclExclusions As List(Of FileTransferMode) = Nothing
        If HideFtpGui Then
            protoclExclusions = New List(Of FileTransferMode)()
            protoclExclusions.Add(FileTransferMode.Ftp)
            protoclExclusions.Add(FileTransferMode.FtpSslExplicit)
            protoclExclusions.Add(FileTransferMode.FtpSslImplicit)
        End If
        If HideSftpGui Then
            protoclExclusions = New List(Of FileTransferMode)()
            protoclExclusions.Add(FileTransferMode.Sftp)
        End If

        ConnectionEditorUtils.BindComboWithEnum(Of FileTransferMode)(cmbProtocol, protoclExclusions)

        ' cmbServerKeyAlgorithm
        If Not HideSftpGui Then
            Dim hka As New List(Of SshHostKeyAlgorithm)()
            hka.Add(SshHostKeyAlgorithm.None)
            hka.Add(SshHostKeyAlgorithm.Any)
            hka.Add(SshHostKeyAlgorithm.Certificate)
            ConnectionEditorUtils.BindComboWithEnum(Of SshHostKeyAlgorithm)(cmbServerKeyAlgorithm, hka)
        End If

        ' cmbServerKeyHashAlgorithm
        If Not HideSftpGui Then
            Dim ha As New List(Of SignatureHashAlgorithm)()
            ha.Add(SignatureHashAlgorithm.MD5SHA1)
            ha.Add(SignatureHashAlgorithm.Unsupported)
            ConnectionEditorUtils.BindComboWithEnum(Of SignatureHashAlgorithm)(cmbServerKeyHashAlgorithm, ha)
        End If

        ' cmbProxyType
        RebindProxyTypeCombo()
    End Sub

    ''' <summary>
    ''' Recalculates visibility of protocol specific controls according to 
    ''' <see cref="HideFtpGui"/> and <see cref="HideSftpGui"/> property values.
    ''' </summary>
    ''' <remarks>
    ''' NOTE: <see cref="HideFtpGui"/> and <see cref="HideSftpGui"/> property values affect also some listbox values etc (and they are not affected by this method).
    ''' </remarks>
    Private Sub RecalculateProtocolSpecificVisibility()
        If HideFtpGui AndAlso HideSftpGui Then
            Throw New InvalidOperationException("Both 'HideFtpGui' and 'HideStpGui' properties cannot be set to true.")
        End If

        If HideFtpGui Then
            cbPassive.Visible = pnlClearCommandChannel.Visible = False
            tabControlMain.TabPages.RemoveByKey("tabSsl")
        End If

        If HideSftpGui Then
            pnlDomain.Visible = cbUseGssApi.Visible = pnlPrivateKey.Visible = False
            tabControlMain.TabPages.RemoveByKey("tabSsh")
        End If
    End Sub

    ''' <summary>
    ''' Removes all invisible controls from this user control's docking containers
    ''' and adjusts height of the containers and of this control according to current content.
    ''' </summary>
    Private Sub RearrangeVisibleControls()
        ' don't execute this method in design-time
        If LicenseManager.UsageMode = LicenseUsageMode.Designtime Then
            Return
        End If

        Dim thisHeaderHeight As Integer = Me.Height - tabControlMain.Height
        ' unfortunately, we cannot compute height of the remaining part of tab control using
        ' tabControlMain.Height - tabControlMain.TabPages["tabServer"].Height;
        ' because tabPage.Height is not affected by tabControl resizing performed by docking
        Dim tabHeaderHeight As Integer = 26

        Dim maxHeight As Integer = 0

        ' tabServer
        RearrangeVisibleControls(grpConnection)
        RearrangeVisibleControls(grpCredentials)
        RearrangeVisibleControls(tabControlMain.TabPages("tabServer"))
        If tabControlMain.TabPages("tabServer").Height > maxHeight Then
            maxHeight = tabControlMain.TabPages("tabServer").Height
        End If

        ' tabProxy
        RearrangeVisibleControls(tabControlMain.TabPages("tabProxy"))
        If tabControlMain.TabPages("tabProxy").Height > maxHeight Then
            maxHeight = tabControlMain.TabPages("tabProxy").Height
        End If

        ' tabSsl
        If tabControlMain.TabPages.ContainsKey("tabSsl") Then
            RearrangeVisibleControls(tabControlMain.TabPages("tabSsl"))
            If tabControlMain.TabPages("tabSsl").Height > maxHeight Then
                maxHeight = tabControlMain.TabPages("tabSsl").Height
            End If
        End If

        ' tabSsh
        If tabControlMain.TabPages.ContainsKey("tabSsh") Then
            RearrangeVisibleControls(tabControlMain.TabPages("tabSsh"))
            If tabControlMain.TabPages("tabSsh").Height > maxHeight Then
                maxHeight = tabControlMain.TabPages("tabSsh").Height
            End If
        End If


        Me.SuspendLayout()
        tabControlMain.Size = New Size(tabControlMain.Width, maxHeight + tabHeaderHeight)
        Me.Size = New Size(Me.Width, tabControlMain.Height + thisHeaderHeight)
        Me.MinimumSize = New Size(Me.MinimumSize.Width, Me.Height)
        Me.ResumeLayout()

        OnHeightRecalculated()
    End Sub

    ''' <summary>
    ''' Removes all invisible controls from given <paramref name="container"/>
    ''' and adjusts height of the container up to the last visible control.<br/>
    ''' Using <see cref="ControlsRearranging"/> or <see cref="ControlsRearranged"/> events it can be extended 
    ''' to add new controls to the beginning or to the end of the controls collection.
    ''' </summary>
    Private Sub RearrangeVisibleControls(container As Control)
        container.SuspendLayout()

        ' rebuild control collection - remove invisible controls
        Dim lst As New ArrayList(container.Controls)
        container.Controls.Clear()

        OnControlsRearranging(container)

        For Each control As Control In lst
            If control.Visible Then
                container.Controls.Add(control)
            End If
        Next

        OnControlsRearranged(container)

        container.ResumeLayout()

        ' recalculate height of the container
        Dim lastControl As Control = container.Controls(0)
        ' docked controls are sorted in reversed order unlike the Controls collection order
        container.Size = New Size(container.Size.Width, lastControl.Location.Y + lastControl.Size.Height + container.Padding.Bottom)

    End Sub

    ''' <summary>
    ''' Enables or disables some controls and resets default values of some controls depending on the currently set protocol.
    ''' </summary>
    Public Sub RecomputeProtocolSpecificFields()
        cbPassive.Enabled = IsPassiveEnabled
        pnlPrivateKey.Enabled = IsPrivateKeyEnabled
        pnlClientCertificate.Enabled = IsClientCertificateEnabled
        cbClearCommandChannel.Enabled = IsClearCommandChannelEnabled
        RecomputeGssApiSpecificFields()

        If Not HideFtpGui Then
            ' that property removes the whole tab page
            tabControlMain.TabPages("tabSsl").Enabled = IsSslTabEnabled
        End If
        If Not HideSftpGui Then
            ' that property removes the whole tab page
            tabControlMain.TabPages("tabSsh").Enabled = IsSshTabEnabled
        End If
        Dim previousProtocolCopy As FileTransferMode = _previousMode

        ConnectionEditorUtils.SetProtocol(_previousMode,
            FileTransferMode,
            AddressOf RememberMode,
            ServerPort,
            AddressOf UpdateServerPort,
            ProxyType,
            AddressOf RememberProxyType)

        If FileTransferMode <> previousProtocolCopy Then
            RebindProxyTypeCombo()
        End If
    End Sub

    Private Sub RememberMode(ByVal previous As FileTransferMode)
        _previousMode = previous
    End Sub

    Private Sub UpdateServerPort(ByVal port As Integer)
        If port = 0 Then
            tbServerPort.Text = ""
        Else
            tbServerPort.Text = port.ToString()
        End If
    End Sub

    Private Sub RememberProxyType(ByVal pxType As FileTransferProxyType)
        ProxyType = pxType
    End Sub

    ''' <summary>
    ''' (re)binds values of cmbProxyType according to current SecureFtpProtocol.
    ''' Tries to keep the selected value.
    ''' </summary>
    Private Sub RebindProxyTypeCombo()
        ' store old selected value
        Dim oldValue As FileTransferProxyType = FileTransferProxyType.None
        If cmbProxyType.SelectedValue IsNot Nothing Then
            oldValue = CType(cmbProxyType.SelectedValue, FileTransferProxyType)
        End If

        ' rebind combo
        Dim proxyExclusions As List(Of FileTransferProxyType) = Nothing
        Select Case FileTransferMode
            Case FileTransferMode.Ftp, FileTransferMode.FtpSslExplicit, FileTransferMode.FtpSslImplicit
                ' hide nothing
                Exit Select
            Case FileTransferMode.Sftp
                proxyExclusions = New List(Of FileTransferProxyType)()
                proxyExclusions.Add(FileTransferProxyType.FtpOpen)
                proxyExclusions.Add(FileTransferProxyType.FtpSite)
                proxyExclusions.Add(FileTransferProxyType.FtpUser)
                Exit Select
            Case Else
                proxyExclusions = New List(Of FileTransferProxyType)()
                ' exclude anything except the "None" value
                For Each item As FileTransferProxyType In [Enum].GetValues(GetType(FileTransferProxyType))
                    If item = FileTransferProxyType.None Then
                        Continue For
                    End If
                    proxyExclusions.Add(item)
                Next
                Exit Select
        End Select

        ConnectionEditorUtils.BindComboWithEnum(Of FileTransferProxyType)(cmbProxyType, proxyExclusions)

        ' try to select previous value
        If oldValue <> FileTransferProxyType.None Then
            For i As Integer = 0 To cmbProxyType.Items.Count - 1
                Dim item As Tuple(Of FileTransferProxyType, String) = DirectCast(cmbProxyType.Items(i), Tuple(Of FileTransferProxyType, String))
                If item.First = oldValue Then
                    cmbProxyType.SelectedIndex = i
                    Exit For
                End If
            Next
        End If

        RecomputeProxySpecificFields()
    End Sub

    Private Sub RecomputeProxySpecificFields()
        tbProxyHost.Enabled =
            tbProxyPort.Enabled =
            tbProxyUsername.Enabled =
            tbProxyPassword.Enabled = ProxyType <> FileTransferProxyType.None
    End Sub

    Private Sub RecomputeGssApiSpecificFields()
        cbUseGssApi.Enabled = IsUseGssApiEnabled
        tbServerDomain.Enabled = IsUseGssApiEnabled AndAlso cbUseGssApi.Checked
    End Sub

    Private Sub RefreshPrivateKeyField()
        If _privateKey IsNot Nothing Then
            tbPrivateKey.Text = String.Format("Fingerprint: {0}", BitConverter.ToString(_privateKey.Fingerprint.ToArray(SignatureHashAlgorithm.MD5)))
        ElseIf Not String.IsNullOrEmpty(_privateKeyFilename) Then
            tbPrivateKey.Text = String.Format("Load from: {0}", PrivateKeyFilename)
        Else
            tbPrivateKey.Text = ""
        End If
    End Sub

    Private Sub RefreshClientCertificateField()
        If _clientCertificate IsNot Nothing Then
            tbClientCertificate.Text = String.Format("CN: {0}, expires: {1:d}", _clientCertificate.LeafCertificate.GetCommonName(), _clientCertificate.LeafCertificate.GetExpirationDate())
        ElseIf Not String.IsNullOrEmpty(_clientCertificateFilename) Then
            tbClientCertificate.Text = String.Format("Load from: {0}", ClientCertificateFilename)
        Else
            tbClientCertificate.Text = ""
        End If
    End Sub

    ''' <summary>
    ''' If the <see cref="ClientCertificateFilename"/> is defined, but the certificate has not been loaded to the <see cref="ClientCertificate"/> property, it loads the certificate.<br/>
    ''' If the certificate requires a password, the method prompts for the password.
    ''' </summary>
    ''' <returns>False - an error has occurred.</returns>
    Public Function EnsureClientCertificate() As Boolean
        If ClientCertificate Is Nothing AndAlso Not String.IsNullOrEmpty(ClientCertificateFilename) Then
            Return LoadClientCertificate()
        End If
        Return True
    End Function

    ''' <summary>
    ''' Loads a certificate from the <see cref="ClientCertificateFilename"/> into the <see cref="ClientCertificate"/> property.<br/>
    ''' If the certificate requires a password, the method prompts for the password.
    ''' </summary>
    ''' <returns>True - the key certificate been loaded or an user does not want any certificate. False - an error occurred.</returns>
    Private Function LoadClientCertificate() As Boolean
        Try
            ' try to load the certificate 
            Dim certificate As CertificateChain = Nothing
            ' (first attempt will be with empty password - only if it won't succeed, we will prompt for the password
            Dim firstAttempt As Boolean = True
            Dim password As String = ""
            While certificate Is Nothing
                Try
                    ClientCertificate = CertificateChain.LoadPfx(ClientCertificateFilename, password, KeySetOptions.Exportable)
                    ' success
                    Return True
                    ' handle invalid password
                Catch ex As CertificateException
                    If ex.Message <> "PFX password is not valid." Then
                        ConnectionEditorUtils.ShowException("Error occurred when importing certificate.", "Import failed", ex)
                        Return False
                    End If
                    Dim dialogPrompt As String
                    If firstAttempt Then
                        dialogPrompt = "The certificate is password protected." & vbCr & vbLf & "Enter the certificate password:"
                    Else
                        dialogPrompt = "The password is wrong." & vbCr & vbLf & "Enter again?"
                    End If
                    Dim pd As New PassphraseDialog(dialogPrompt)
                    pd.Size = New Size(pd.Width, pd.Height + 13)
                    ' add extra line for the 2-lines password prompt
                    If pd.ShowDialog() <> DialogResult.OK Then
                        Return True
                    End If
                    password = pd.Passphrase
                    firstAttempt = False
                Catch ex As Exception
                    ConnectionEditorUtils.ShowException("Error occurred when importing certificate.", "Import failed", ex)
                    Return False
                End Try
            End While
            ' never reached
            Return False
        Finally
            ' once the certificate has not been successfully loaded, clear the stored filename
            If ClientCertificate Is Nothing Then
                ClientCertificateFilename = Nothing
            End If
        End Try
    End Function

    ''' <summary>
    ''' If the <see cref="PrivateKeyFilename"/> is defined, but the key has not been loaded to the <see cref="PrivateKey"/> property, it loads the key.<br/>
    ''' If the key requires a password, the method prompts for the password.
    ''' </summary>
    ''' <returns>False - an error has occurred.</returns>
    Public Function EnsurePrivateKey() As Boolean
        If PrivateKey Is Nothing AndAlso Not String.IsNullOrEmpty(PrivateKeyFilename) Then
            Return LoadPrivateKey()
        End If
        Return True
    End Function
    ''' <summary>
    ''' Loads a key from the <see cref="PrivateKeyFilename"/> into the <see cref="PrivateKey"/> property.<br/>
    ''' If the key requires a password, the method prompts for the password.
    ''' </summary>
    ''' <returns>True - the key has been loaded or an user does not want any key. False - an error occurred.</returns>
    Private Function LoadPrivateKey() As Boolean
        Try
            ' try to load the key 
            Dim key As SshPrivateKey = Nothing
            ' (first attempt will be with empty password - only if it won't succeed, we will prompt for the password
            Dim firstAttempt As Boolean = True
            Dim password As String = ""
            While key Is Nothing
                Try
                    PrivateKey = New SshPrivateKey(PrivateKeyFilename, password)
                    ' success
                    Return True
                    ' handle invalid password
                Catch ex As System.Security.Cryptography.CryptographicException
                    If ex.Message <> "Invalid password or bad data." Then
                        ConnectionEditorUtils.ShowException("Error occured when importing key.", "Import failed", ex)
                        Return False
                    End If
                    Dim dialogPrompt As String
                    If firstAttempt Then
                        dialogPrompt = "The private key is password protected." & vbCr & vbLf & "Enter the private key password:"
                    Else
                        dialogPrompt = "The password is wrong." & vbCr & vbLf & "Enter again?"
                    End If
                    Dim pd As New PassphraseDialog(dialogPrompt)
                    pd.Size = New Size(pd.Width, pd.Height + 13)
                    ' add extra line for the 2-lines password prompt
                    If pd.ShowDialog() <> DialogResult.OK Then
                        PrivateKeyFilename = ""
                        Return True
                    End If
                    password = pd.Passphrase
                    firstAttempt = False
                Catch ex As Exception
                    PrivateKeyFilename = ""
                    ConnectionEditorUtils.ShowException("Error occured when importing key.", "Import failed", ex)
                    Return False
                End Try
            End While
            ' never reached
            Return False
        Finally
            ' once the key has not been successfully loaded, clear the stored filename
            If PrivateKey Is Nothing Then
                PrivateKeyFilename = Nothing
            End If
        End Try
    End Function

#End Region

#Region "Event handlers"

    Private Sub OnHeightRecalculated()
        RaiseEvent HeightRecalculated(Me, EventArgs.Empty)
    End Sub

    Private Sub OnControlsRearranging(sender As Object)
        RaiseEvent ControlsRearranging(sender, EventArgs.Empty)
    End Sub

    Private Sub OnControlsRearranged(sender As Object)
        RaiseEvent ControlsRearranged(sender, EventArgs.Empty)
    End Sub

    Private Sub cmbProtocol_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbProtocol.SelectedIndexChanged
        RecomputeProtocolSpecificFields()
    End Sub

    Private Sub cmbProxyType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbProxyType.SelectedIndexChanged
        RecomputeProxySpecificFields()
    End Sub

    Private Sub cbUseGssApi_CheckedChanged(sender As Object, e As EventArgs) Handles cbUseGssApi.CheckedChanged
        If Not cbUseGssApi.Checked Then
            ' when clearing GssApi checbox...
            tbServerDomain.Text = ""
        End If
        ' ...clear the domain name as well
        RecomputeGssApiSpecificFields()
    End Sub

    Private Sub tbServerHostOrPort_TextChanged(sender As Object, e As EventArgs) Handles tbServerHost.TextChanged
        ' since we are using another server, clear server certificate or fingerprint
        Select Case FileTransferMode
            Case FileTransferMode.FtpSslExplicit, FileTransferMode.FtpSslImplicit
                ServerCertificateThumbprint = ""
                Exit Select
            Case FileTransferMode.Sftp
                ServerKeyFingerprint = ""
                Exit Select
        End Select
    End Sub

    Private Sub btnImportClientCertificate_Click(sender As Object, e As EventArgs) Handles btnImportClientCertificate.Click
        ' ask for certificate
        Dim import As New ImportCertificateDialog()

        If import.ShowDialog() = DialogResult.OK Then
            ClientCertificateFilename = import.ClientCertificateFilename
            ClientCertificate = import.ClientCertificate
        End If
    End Sub

    Private Sub btnViewClientCertificate_Click(sender As Object, e As EventArgs) Handles btnViewClientCertificate.Click
        EnsureClientCertificate()

        If ClientCertificate Is Nothing Then
            ConnectionEditorUtils.ShowWarning("No certificate has been defined.", "View certificate")
            Return
        End If

        X509Certificate2UI.DisplayCertificate(New X509Certificate2(ClientCertificate.LeafCertificate.GetRawCertData()))
    End Sub

    Private Sub btnClearClientCertificate_Click(sender As Object, e As EventArgs) Handles btnClearClientCertificate.Click
        ClientCertificate = Nothing
        ClientCertificateFilename = ""
    End Sub

    Private Sub btnImportPrivateKey_Click(sender As Object, e As EventArgs) Handles btnImportPrivateKey.Click
        ' ask for private key file
        Dim fd As New OpenFileDialog()
        fd.Title = "Choose private key file"
        If fd.ShowDialog() <> DialogResult.OK Then
            Return
        End If
        PrivateKeyFilename = fd.FileName
        LoadPrivateKey()
    End Sub

    Private Sub btnClearPrivateKey_Click(sender As Object, e As EventArgs) Handles btnClearPrivateKey.Click
        PrivateKey = Nothing
        PrivateKeyFilename = ""
    End Sub

    Protected Overridable Sub rbServerCertificateStored_CheckedChanged(sender As Object, e As EventArgs) Handles rbServerCertificateStored.CheckedChanged
        pnlLocalyStoredCertificate.Enabled = rbServerCertificateStored.Checked
    End Sub

    Protected Overridable Sub rbServerKeyStored_CheckedChanged(sender As Object, e As EventArgs) Handles rbServerKeyStored.CheckedChanged
        pnlLocalyStoredKey.Enabled = rbServerKeyStored.Checked
    End Sub

    Private Sub cmbServerKeyHashAlgorithm_SelectedValueChanged(sender As Object, e As EventArgs) Handles cmbServerKeyHashAlgorithm.SelectedValueChanged
        ServerKeyFingerprint = ""
    End Sub

#End Region


    ''' <summary> 
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary> 
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

#Region "Component Designer generated code"

    ''' <summary> 
    ''' Required method for Designer support - do not modify 
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.tabControlMain = New System.Windows.Forms.TabControl()
        Me.tabServer = New System.Windows.Forms.TabPage()
        Me.grpCredentials = New System.Windows.Forms.GroupBox()
        Me.pnlClearCommandChannel = New System.Windows.Forms.Panel()
        Me.cbClearCommandChannel = New System.Windows.Forms.CheckBox()
        Me.pnlPrivateKey = New System.Windows.Forms.Panel()
        Me.lblPrivateKey = New System.Windows.Forms.Label()
        Me.btnClearPrivateKey = New System.Windows.Forms.Button()
        Me.tbPrivateKey = New System.Windows.Forms.TextBox()
        Me.btnImportPrivateKey = New System.Windows.Forms.Button()
        Me.pnlClientCertificate = New System.Windows.Forms.Panel()
        Me.label8 = New System.Windows.Forms.Label()
        Me.btnClearClientCertificate = New System.Windows.Forms.Button()
        Me.tbClientCertificate = New System.Windows.Forms.TextBox()
        Me.btnViewClientCertificate = New System.Windows.Forms.Button()
        Me.btnImportClientCertificate = New System.Windows.Forms.Button()
        Me.pnlDomain = New System.Windows.Forms.Panel()
        Me.tbServerDomain = New System.Windows.Forms.TextBox()
        Me.lblDomain = New System.Windows.Forms.Label()
        Me.pnlUsernamePassword = New System.Windows.Forms.Panel()
        Me.cbStorePassword = New System.Windows.Forms.CheckBox()
        Me.cbUseGssApi = New System.Windows.Forms.CheckBox()
        Me.tbServerUser = New System.Windows.Forms.TextBox()
        Me.label4 = New System.Windows.Forms.Label()
        Me.label5 = New System.Windows.Forms.Label()
        Me.tbServerPassword = New System.Windows.Forms.TextBox()
        Me.grpConnection = New System.Windows.Forms.GroupBox()
        Me.pnlHostnameProtocol = New System.Windows.Forms.Panel()
        Me.cbPassive = New System.Windows.Forms.CheckBox()
        Me.tbServerPort = New System.Windows.Forms.TextBox()
        Me.label3 = New System.Windows.Forms.Label()
        Me.label1 = New System.Windows.Forms.Label()
        Me.cmbProtocol = New System.Windows.Forms.ComboBox()
        Me.tbServerHost = New System.Windows.Forms.TextBox()
        Me.label2 = New System.Windows.Forms.Label()
        Me.tabProxy = New System.Windows.Forms.TabPage()
        Me.pnlProxy = New System.Windows.Forms.Panel()
        Me.label19 = New System.Windows.Forms.Label()
        Me.tbProxyUsername = New System.Windows.Forms.TextBox()
        Me.label11 = New System.Windows.Forms.Label()
        Me.cmbProxyType = New System.Windows.Forms.ComboBox()
        Me.label13 = New System.Windows.Forms.Label()
        Me.label14 = New System.Windows.Forms.Label()
        Me.tbProxyPassword = New System.Windows.Forms.TextBox()
        Me.tbProxyPort = New System.Windows.Forms.TextBox()
        Me.label6 = New System.Windows.Forms.Label()
        Me.tbProxyHost = New System.Windows.Forms.TextBox()
        Me.label12 = New System.Windows.Forms.Label()
        Me.tabSsl = New System.Windows.Forms.TabPage()
        Me.panel1 = New System.Windows.Forms.Panel()
        Me.cmbSuites = New System.Windows.Forms.ComboBox()
        Me.cbAllowTls13 = New System.Windows.Forms.CheckBox()
        Me.cbAllowTls12 = New System.Windows.Forms.CheckBox()
        Me.cbAllowTls11 = New System.Windows.Forms.CheckBox()
        Me.cbAllowTls10 = New System.Windows.Forms.CheckBox()
        Me.label23 = New System.Windows.Forms.Label()
        Me.label22 = New System.Windows.Forms.Label()
        Me.pnlServerCertificate = New System.Windows.Forms.Panel()
        Me.pnlLocalyStoredCertificate = New System.Windows.Forms.Panel()
        Me.label9 = New System.Windows.Forms.Label()
        Me.tbServerCertificateThumbprint = New System.Windows.Forms.TextBox()
        Me.label10 = New System.Windows.Forms.Label()
        Me.rbServerCertificateAny = New System.Windows.Forms.RadioButton()
        Me.rbServerCertificateStored = New System.Windows.Forms.RadioButton()
        Me.rbServerCertificateWindows = New System.Windows.Forms.RadioButton()
        Me.label7 = New System.Windows.Forms.Label()
        Me.tabSsh = New System.Windows.Forms.TabPage()
        Me.pnlServerKey = New System.Windows.Forms.Panel()
        Me.cmbSshSuites = New System.Windows.Forms.ComboBox()
        Me.Label24 = New System.Windows.Forms.Label()
        Me.pnlLocalyStoredKey = New System.Windows.Forms.Panel()
        Me.label21 = New System.Windows.Forms.Label()
        Me.label20 = New System.Windows.Forms.Label()
        Me.cmbServerKeyAlgorithm = New System.Windows.Forms.ComboBox()
        Me.label18 = New System.Windows.Forms.Label()
        Me.tbServerKeyFingerprint = New System.Windows.Forms.TextBox()
        Me.cmbServerKeyHashAlgorithm = New System.Windows.Forms.ComboBox()
        Me.label15 = New System.Windows.Forms.Label()
        Me.label16 = New System.Windows.Forms.Label()
        Me.rbServerKeyAny = New System.Windows.Forms.RadioButton()
        Me.rbServerKeyStored = New System.Windows.Forms.RadioButton()
        Me.label17 = New System.Windows.Forms.Label()
        Me.tabControlMain.SuspendLayout()
        Me.tabServer.SuspendLayout()
        Me.grpCredentials.SuspendLayout()
        Me.pnlClearCommandChannel.SuspendLayout()
        Me.pnlPrivateKey.SuspendLayout()
        Me.pnlClientCertificate.SuspendLayout()
        Me.pnlDomain.SuspendLayout()
        Me.pnlUsernamePassword.SuspendLayout()
        Me.grpConnection.SuspendLayout()
        Me.pnlHostnameProtocol.SuspendLayout()
        Me.tabProxy.SuspendLayout()
        Me.pnlProxy.SuspendLayout()
        Me.tabSsl.SuspendLayout()
        Me.panel1.SuspendLayout()
        Me.pnlServerCertificate.SuspendLayout()
        Me.pnlLocalyStoredCertificate.SuspendLayout()
        Me.tabSsh.SuspendLayout()
        Me.pnlServerKey.SuspendLayout()
        Me.pnlLocalyStoredKey.SuspendLayout()
        Me.SuspendLayout()
        '
        'tabControlMain
        '
        Me.tabControlMain.Controls.Add(Me.tabServer)
        Me.tabControlMain.Controls.Add(Me.tabProxy)
        Me.tabControlMain.Controls.Add(Me.tabSsl)
        Me.tabControlMain.Controls.Add(Me.tabSsh)
        Me.tabControlMain.Dock = System.Windows.Forms.DockStyle.Fill
        Me.tabControlMain.Location = New System.Drawing.Point(0, 0)
        Me.tabControlMain.Name = "tabControlMain"
        Me.tabControlMain.SelectedIndex = 0
        Me.tabControlMain.Size = New System.Drawing.Size(620, 357)
        Me.tabControlMain.TabIndex = 1008
        '
        'tabServer
        '
        Me.tabServer.BackColor = System.Drawing.SystemColors.Control
        Me.tabServer.Controls.Add(Me.grpCredentials)
        Me.tabServer.Controls.Add(Me.grpConnection)
        Me.tabServer.Location = New System.Drawing.Point(4, 22)
        Me.tabServer.Name = "tabServer"
        Me.tabServer.Padding = New System.Windows.Forms.Padding(3)
        Me.tabServer.Size = New System.Drawing.Size(612, 331)
        Me.tabServer.TabIndex = 0
        Me.tabServer.Text = "Server"
        '
        'grpCredentials
        '
        Me.grpCredentials.BackColor = System.Drawing.Color.Transparent
        Me.grpCredentials.Controls.Add(Me.pnlClearCommandChannel)
        Me.grpCredentials.Controls.Add(Me.pnlPrivateKey)
        Me.grpCredentials.Controls.Add(Me.pnlClientCertificate)
        Me.grpCredentials.Controls.Add(Me.pnlDomain)
        Me.grpCredentials.Controls.Add(Me.pnlUsernamePassword)
        Me.grpCredentials.Dock = System.Windows.Forms.DockStyle.Top
        Me.grpCredentials.Location = New System.Drawing.Point(3, 114)
        Me.grpCredentials.Name = "grpCredentials"
        Me.grpCredentials.Size = New System.Drawing.Size(606, 172)
        Me.grpCredentials.TabIndex = 1
        Me.grpCredentials.TabStop = False
        Me.grpCredentials.Text = "Credentials"
        '
        'pnlClearCommandChannel
        '
        Me.pnlClearCommandChannel.Controls.Add(Me.cbClearCommandChannel)
        Me.pnlClearCommandChannel.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlClearCommandChannel.Location = New System.Drawing.Point(3, 137)
        Me.pnlClearCommandChannel.Name = "pnlClearCommandChannel"
        Me.pnlClearCommandChannel.Size = New System.Drawing.Size(600, 23)
        Me.pnlClearCommandChannel.TabIndex = 4
        '
        'cbClearCommandChannel
        '
        Me.cbClearCommandChannel.AutoSize = True
        Me.cbClearCommandChannel.Location = New System.Drawing.Point(99, 3)
        Me.cbClearCommandChannel.Name = "cbClearCommandChannel"
        Me.cbClearCommandChannel.Size = New System.Drawing.Size(140, 17)
        Me.cbClearCommandChannel.TabIndex = 0
        Me.cbClearCommandChannel.Text = "Clear command channel"
        Me.cbClearCommandChannel.UseVisualStyleBackColor = True
        '
        'pnlPrivateKey
        '
        Me.pnlPrivateKey.Controls.Add(Me.lblPrivateKey)
        Me.pnlPrivateKey.Controls.Add(Me.btnClearPrivateKey)
        Me.pnlPrivateKey.Controls.Add(Me.tbPrivateKey)
        Me.pnlPrivateKey.Controls.Add(Me.btnImportPrivateKey)
        Me.pnlPrivateKey.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlPrivateKey.Location = New System.Drawing.Point(3, 114)
        Me.pnlPrivateKey.Name = "pnlPrivateKey"
        Me.pnlPrivateKey.Size = New System.Drawing.Size(600, 23)
        Me.pnlPrivateKey.TabIndex = 3
        '
        'lblPrivateKey
        '
        Me.lblPrivateKey.AutoSize = True
        Me.lblPrivateKey.Location = New System.Drawing.Point(3, 5)
        Me.lblPrivateKey.Name = "lblPrivateKey"
        Me.lblPrivateKey.Size = New System.Drawing.Size(63, 13)
        Me.lblPrivateKey.TabIndex = 13
        Me.lblPrivateKey.Text = "Private key:"
        '
        'btnClearPrivateKey
        '
        Me.btnClearPrivateKey.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnClearPrivateKey.Location = New System.Drawing.Point(557, 0)
        Me.btnClearPrivateKey.Name = "btnClearPrivateKey"
        Me.btnClearPrivateKey.Size = New System.Drawing.Size(40, 23)
        Me.btnClearPrivateKey.TabIndex = 1
        Me.btnClearPrivateKey.Text = "Clear"
        Me.btnClearPrivateKey.UseVisualStyleBackColor = True
        '
        'tbPrivateKey
        '
        Me.tbPrivateKey.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbPrivateKey.Location = New System.Drawing.Point(99, 2)
        Me.tbPrivateKey.Name = "tbPrivateKey"
        Me.tbPrivateKey.ReadOnly = True
        Me.tbPrivateKey.Size = New System.Drawing.Size(339, 20)
        Me.tbPrivateKey.TabIndex = 0
        Me.tbPrivateKey.TabStop = False
        '
        'btnImportPrivateKey
        '
        Me.btnImportPrivateKey.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnImportPrivateKey.Location = New System.Drawing.Point(444, 0)
        Me.btnImportPrivateKey.Name = "btnImportPrivateKey"
        Me.btnImportPrivateKey.Size = New System.Drawing.Size(55, 23)
        Me.btnImportPrivateKey.TabIndex = 0
        Me.btnImportPrivateKey.Text = "Import..."
        Me.btnImportPrivateKey.UseVisualStyleBackColor = True
        '
        'pnlClientCertificate
        '
        Me.pnlClientCertificate.Controls.Add(Me.label8)
        Me.pnlClientCertificate.Controls.Add(Me.btnClearClientCertificate)
        Me.pnlClientCertificate.Controls.Add(Me.tbClientCertificate)
        Me.pnlClientCertificate.Controls.Add(Me.btnViewClientCertificate)
        Me.pnlClientCertificate.Controls.Add(Me.btnImportClientCertificate)
        Me.pnlClientCertificate.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlClientCertificate.Location = New System.Drawing.Point(3, 91)
        Me.pnlClientCertificate.Name = "pnlClientCertificate"
        Me.pnlClientCertificate.Size = New System.Drawing.Size(600, 23)
        Me.pnlClientCertificate.TabIndex = 2
        '
        'label8
        '
        Me.label8.AutoSize = True
        Me.label8.Location = New System.Drawing.Point(3, 5)
        Me.label8.Name = "label8"
        Me.label8.Size = New System.Drawing.Size(85, 13)
        Me.label8.TabIndex = 13
        Me.label8.Text = "Client certificate:"
        '
        'btnClearClientCertificate
        '
        Me.btnClearClientCertificate.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnClearClientCertificate.Location = New System.Drawing.Point(557, 0)
        Me.btnClearClientCertificate.Name = "btnClearClientCertificate"
        Me.btnClearClientCertificate.Size = New System.Drawing.Size(40, 23)
        Me.btnClearClientCertificate.TabIndex = 2
        Me.btnClearClientCertificate.Text = "Clear"
        Me.btnClearClientCertificate.UseVisualStyleBackColor = True
        '
        'tbClientCertificate
        '
        Me.tbClientCertificate.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbClientCertificate.Location = New System.Drawing.Point(99, 2)
        Me.tbClientCertificate.Name = "tbClientCertificate"
        Me.tbClientCertificate.ReadOnly = True
        Me.tbClientCertificate.Size = New System.Drawing.Size(339, 20)
        Me.tbClientCertificate.TabIndex = 0
        Me.tbClientCertificate.TabStop = False
        '
        'btnViewClientCertificate
        '
        Me.btnViewClientCertificate.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnViewClientCertificate.Location = New System.Drawing.Point(505, 0)
        Me.btnViewClientCertificate.Name = "btnViewClientCertificate"
        Me.btnViewClientCertificate.Size = New System.Drawing.Size(48, 23)
        Me.btnViewClientCertificate.TabIndex = 1
        Me.btnViewClientCertificate.Text = "View..."
        Me.btnViewClientCertificate.UseVisualStyleBackColor = True
        '
        'btnImportClientCertificate
        '
        Me.btnImportClientCertificate.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnImportClientCertificate.Location = New System.Drawing.Point(444, 0)
        Me.btnImportClientCertificate.Name = "btnImportClientCertificate"
        Me.btnImportClientCertificate.Size = New System.Drawing.Size(55, 23)
        Me.btnImportClientCertificate.TabIndex = 0
        Me.btnImportClientCertificate.Text = "Import..."
        Me.btnImportClientCertificate.UseVisualStyleBackColor = True
        '
        'pnlDomain
        '
        Me.pnlDomain.Controls.Add(Me.tbServerDomain)
        Me.pnlDomain.Controls.Add(Me.lblDomain)
        Me.pnlDomain.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlDomain.Location = New System.Drawing.Point(3, 68)
        Me.pnlDomain.Name = "pnlDomain"
        Me.pnlDomain.Size = New System.Drawing.Size(600, 23)
        Me.pnlDomain.TabIndex = 1
        '
        'tbServerDomain
        '
        Me.tbServerDomain.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbServerDomain.Location = New System.Drawing.Point(99, 2)
        Me.tbServerDomain.Name = "tbServerDomain"
        Me.tbServerDomain.Size = New System.Drawing.Size(339, 20)
        Me.tbServerDomain.TabIndex = 0
        '
        'lblDomain
        '
        Me.lblDomain.AutoSize = True
        Me.lblDomain.Location = New System.Drawing.Point(3, 5)
        Me.lblDomain.Name = "lblDomain"
        Me.lblDomain.Size = New System.Drawing.Size(46, 13)
        Me.lblDomain.TabIndex = 13
        Me.lblDomain.Text = "Domain:"
        '
        'pnlUsernamePassword
        '
        Me.pnlUsernamePassword.Controls.Add(Me.cbStorePassword)
        Me.pnlUsernamePassword.Controls.Add(Me.cbUseGssApi)
        Me.pnlUsernamePassword.Controls.Add(Me.tbServerUser)
        Me.pnlUsernamePassword.Controls.Add(Me.label4)
        Me.pnlUsernamePassword.Controls.Add(Me.label5)
        Me.pnlUsernamePassword.Controls.Add(Me.tbServerPassword)
        Me.pnlUsernamePassword.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlUsernamePassword.Location = New System.Drawing.Point(3, 16)
        Me.pnlUsernamePassword.Name = "pnlUsernamePassword"
        Me.pnlUsernamePassword.Size = New System.Drawing.Size(600, 52)
        Me.pnlUsernamePassword.TabIndex = 0
        '
        'cbStorePassword
        '
        Me.cbStorePassword.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cbStorePassword.AutoSize = True
        Me.cbStorePassword.Location = New System.Drawing.Point(444, 30)
        Me.cbStorePassword.Name = "cbStorePassword"
        Me.cbStorePassword.Size = New System.Drawing.Size(99, 17)
        Me.cbStorePassword.TabIndex = 15
        Me.cbStorePassword.TabStop = False
        Me.cbStorePassword.Text = "Store password"
        Me.cbStorePassword.UseVisualStyleBackColor = True
        '
        'cbUseGssApi
        '
        Me.cbUseGssApi.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cbUseGssApi.AutoSize = True
        Me.cbUseGssApi.Location = New System.Drawing.Point(444, 4)
        Me.cbUseGssApi.Name = "cbUseGssApi"
        Me.cbUseGssApi.Size = New System.Drawing.Size(87, 17)
        Me.cbUseGssApi.TabIndex = 14
        Me.cbUseGssApi.TabStop = False
        Me.cbUseGssApi.Text = "Use GSSAPI"
        Me.cbUseGssApi.UseVisualStyleBackColor = True
        '
        'tbServerUser
        '
        Me.tbServerUser.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbServerUser.Location = New System.Drawing.Point(99, 2)
        Me.tbServerUser.Name = "tbServerUser"
        Me.tbServerUser.Size = New System.Drawing.Size(339, 20)
        Me.tbServerUser.TabIndex = 0
        '
        'label4
        '
        Me.label4.AutoSize = True
        Me.label4.Location = New System.Drawing.Point(3, 5)
        Me.label4.Name = "label4"
        Me.label4.Size = New System.Drawing.Size(61, 13)
        Me.label4.TabIndex = 11
        Me.label4.Text = "User name:"
        '
        'label5
        '
        Me.label5.AutoSize = True
        Me.label5.Location = New System.Drawing.Point(3, 31)
        Me.label5.Name = "label5"
        Me.label5.Size = New System.Drawing.Size(56, 13)
        Me.label5.TabIndex = 11
        Me.label5.Text = "Password:"
        '
        'tbServerPassword
        '
        Me.tbServerPassword.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbServerPassword.Location = New System.Drawing.Point(99, 28)
        Me.tbServerPassword.Name = "tbServerPassword"
        Me.tbServerPassword.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
        Me.tbServerPassword.Size = New System.Drawing.Size(339, 20)
        Me.tbServerPassword.TabIndex = 1
        '
        'grpConnection
        '
        Me.grpConnection.Controls.Add(Me.pnlHostnameProtocol)
        Me.grpConnection.Dock = System.Windows.Forms.DockStyle.Top
        Me.grpConnection.Location = New System.Drawing.Point(3, 3)
        Me.grpConnection.Name = "grpConnection"
        Me.grpConnection.Size = New System.Drawing.Size(606, 111)
        Me.grpConnection.TabIndex = 0
        Me.grpConnection.TabStop = False
        Me.grpConnection.Text = "Connection"
        '
        'pnlHostnameProtocol
        '
        Me.pnlHostnameProtocol.Controls.Add(Me.cbPassive)
        Me.pnlHostnameProtocol.Controls.Add(Me.tbServerPort)
        Me.pnlHostnameProtocol.Controls.Add(Me.label3)
        Me.pnlHostnameProtocol.Controls.Add(Me.label1)
        Me.pnlHostnameProtocol.Controls.Add(Me.cmbProtocol)
        Me.pnlHostnameProtocol.Controls.Add(Me.tbServerHost)
        Me.pnlHostnameProtocol.Controls.Add(Me.label2)
        Me.pnlHostnameProtocol.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlHostnameProtocol.Location = New System.Drawing.Point(3, 16)
        Me.pnlHostnameProtocol.Margin = New System.Windows.Forms.Padding(0)
        Me.pnlHostnameProtocol.Name = "pnlHostnameProtocol"
        Me.pnlHostnameProtocol.Size = New System.Drawing.Size(600, 55)
        Me.pnlHostnameProtocol.TabIndex = 138
        '
        'cbPassive
        '
        Me.cbPassive.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cbPassive.AutoSize = True
        Me.cbPassive.Location = New System.Drawing.Point(444, 32)
        Me.cbPassive.Name = "cbPassive"
        Me.cbPassive.Size = New System.Drawing.Size(92, 17)
        Me.cbPassive.TabIndex = 3
        Me.cbPassive.Text = "Passive mode"
        Me.cbPassive.UseVisualStyleBackColor = True
        '
        'tbServerPort
        '
        Me.tbServerPort.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbServerPort.Location = New System.Drawing.Point(468, 3)
        Me.tbServerPort.Name = "tbServerPort"
        Me.tbServerPort.Size = New System.Drawing.Size(129, 20)
        Me.tbServerPort.TabIndex = 1
        '
        'label3
        '
        Me.label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.label3.AutoSize = True
        Me.label3.Location = New System.Drawing.Point(441, 6)
        Me.label3.Name = "label3"
        Me.label3.Size = New System.Drawing.Size(29, 13)
        Me.label3.TabIndex = 27
        Me.label3.Text = "Port:"
        '
        'label1
        '
        Me.label1.AutoSize = True
        Me.label1.Location = New System.Drawing.Point(3, 33)
        Me.label1.Name = "label1"
        Me.label1.Size = New System.Drawing.Size(49, 13)
        Me.label1.TabIndex = 26
        Me.label1.Text = "Protocol:"
        '
        'cmbProtocol
        '
        Me.cmbProtocol.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmbProtocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbProtocol.FormattingEnabled = True
        Me.cmbProtocol.Location = New System.Drawing.Point(99, 30)
        Me.cmbProtocol.Name = "cmbProtocol"
        Me.cmbProtocol.Size = New System.Drawing.Size(339, 21)
        Me.cmbProtocol.TabIndex = 2
        '
        'tbServerHost
        '
        Me.tbServerHost.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbServerHost.Location = New System.Drawing.Point(99, 3)
        Me.tbServerHost.Name = "tbServerHost"
        Me.tbServerHost.Size = New System.Drawing.Size(339, 20)
        Me.tbServerHost.TabIndex = 0
        '
        'label2
        '
        Me.label2.AutoSize = True
        Me.label2.Location = New System.Drawing.Point(3, 6)
        Me.label2.Name = "label2"
        Me.label2.Size = New System.Drawing.Size(61, 13)
        Me.label2.TabIndex = 25
        Me.label2.Text = "Host name:"
        '
        'tabProxy
        '
        Me.tabProxy.BackColor = System.Drawing.SystemColors.Control
        Me.tabProxy.Controls.Add(Me.pnlProxy)
        Me.tabProxy.Location = New System.Drawing.Point(4, 22)
        Me.tabProxy.Name = "tabProxy"
        Me.tabProxy.Padding = New System.Windows.Forms.Padding(3)
        Me.tabProxy.Size = New System.Drawing.Size(612, 331)
        Me.tabProxy.TabIndex = 1
        Me.tabProxy.Text = "Proxy"
        '
        'pnlProxy
        '
        Me.pnlProxy.Controls.Add(Me.label19)
        Me.pnlProxy.Controls.Add(Me.tbProxyUsername)
        Me.pnlProxy.Controls.Add(Me.label11)
        Me.pnlProxy.Controls.Add(Me.cmbProxyType)
        Me.pnlProxy.Controls.Add(Me.label13)
        Me.pnlProxy.Controls.Add(Me.label14)
        Me.pnlProxy.Controls.Add(Me.tbProxyPassword)
        Me.pnlProxy.Controls.Add(Me.tbProxyPort)
        Me.pnlProxy.Controls.Add(Me.label6)
        Me.pnlProxy.Controls.Add(Me.tbProxyHost)
        Me.pnlProxy.Controls.Add(Me.label12)
        Me.pnlProxy.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlProxy.Location = New System.Drawing.Point(3, 3)
        Me.pnlProxy.Margin = New System.Windows.Forms.Padding(0)
        Me.pnlProxy.Name = "pnlProxy"
        Me.pnlProxy.Size = New System.Drawing.Size(606, 116)
        Me.pnlProxy.TabIndex = 139
        '
        'label19
        '
        Me.label19.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.label19.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.label19.ForeColor = System.Drawing.SystemColors.ControlDarkDark
        Me.label19.Location = New System.Drawing.Point(446, 60)
        Me.label19.Name = "label19"
        Me.label19.Size = New System.Drawing.Size(157, 43)
        Me.label19.TabIndex = 125
        Me.label19.Text = "Leave the 'User name' and 'Password' fields empty when not needed."
        '
        'tbProxyUsername
        '
        Me.tbProxyUsername.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbProxyUsername.Location = New System.Drawing.Point(99, 57)
        Me.tbProxyUsername.Name = "tbProxyUsername"
        Me.tbProxyUsername.Size = New System.Drawing.Size(339, 20)
        Me.tbProxyUsername.TabIndex = 3
        '
        'label11
        '
        Me.label11.AutoSize = True
        Me.label11.Location = New System.Drawing.Point(3, 7)
        Me.label11.Name = "label11"
        Me.label11.Size = New System.Drawing.Size(59, 13)
        Me.label11.TabIndex = 26
        Me.label11.Text = "Proxy type:"
        '
        'cmbProxyType
        '
        Me.cmbProxyType.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.cmbProxyType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbProxyType.FormattingEnabled = True
        Me.cmbProxyType.Location = New System.Drawing.Point(99, 4)
        Me.cmbProxyType.Name = "cmbProxyType"
        Me.cmbProxyType.Size = New System.Drawing.Size(339, 21)
        Me.cmbProxyType.TabIndex = 0
        '
        'label13
        '
        Me.label13.AutoSize = True
        Me.label13.Location = New System.Drawing.Point(3, 60)
        Me.label13.Name = "label13"
        Me.label13.Size = New System.Drawing.Size(61, 13)
        Me.label13.TabIndex = 122
        Me.label13.Text = "User name:"
        '
        'label14
        '
        Me.label14.AutoSize = True
        Me.label14.Location = New System.Drawing.Point(3, 86)
        Me.label14.Name = "label14"
        Me.label14.Size = New System.Drawing.Size(56, 13)
        Me.label14.TabIndex = 121
        Me.label14.Text = "Password:"
        '
        'tbProxyPassword
        '
        Me.tbProxyPassword.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbProxyPassword.Location = New System.Drawing.Point(99, 83)
        Me.tbProxyPassword.Name = "tbProxyPassword"
        Me.tbProxyPassword.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
        Me.tbProxyPassword.Size = New System.Drawing.Size(339, 20)
        Me.tbProxyPassword.TabIndex = 4
        '
        'tbProxyPort
        '
        Me.tbProxyPort.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbProxyPort.Location = New System.Drawing.Point(474, 31)
        Me.tbProxyPort.Name = "tbProxyPort"
        Me.tbProxyPort.Size = New System.Drawing.Size(129, 20)
        Me.tbProxyPort.TabIndex = 2
        '
        'label6
        '
        Me.label6.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.label6.AutoSize = True
        Me.label6.Location = New System.Drawing.Point(444, 34)
        Me.label6.Name = "label6"
        Me.label6.Size = New System.Drawing.Size(29, 13)
        Me.label6.TabIndex = 27
        Me.label6.Text = "Port:"
        '
        'tbProxyHost
        '
        Me.tbProxyHost.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbProxyHost.Location = New System.Drawing.Point(99, 31)
        Me.tbProxyHost.Name = "tbProxyHost"
        Me.tbProxyHost.Size = New System.Drawing.Size(339, 20)
        Me.tbProxyHost.TabIndex = 1
        '
        'label12
        '
        Me.label12.AutoSize = True
        Me.label12.Location = New System.Drawing.Point(3, 34)
        Me.label12.Name = "label12"
        Me.label12.Size = New System.Drawing.Size(88, 13)
        Me.label12.TabIndex = 25
        Me.label12.Text = "Proxy host name:"
        '
        'tabSsl
        '
        Me.tabSsl.Controls.Add(Me.panel1)
        Me.tabSsl.Controls.Add(Me.pnlServerCertificate)
        Me.tabSsl.Location = New System.Drawing.Point(4, 22)
        Me.tabSsl.Name = "tabSsl"
        Me.tabSsl.Padding = New System.Windows.Forms.Padding(3)
        Me.tabSsl.Size = New System.Drawing.Size(612, 331)
        Me.tabSsl.TabIndex = 2
        Me.tabSsl.Text = "TLS/SSL"
        '
        'panel1
        '
        Me.panel1.Controls.Add(Me.cmbSuites)
        Me.panel1.Controls.Add(Me.cbAllowTls13)
        Me.panel1.Controls.Add(Me.cbAllowTls12)
        Me.panel1.Controls.Add(Me.cbAllowTls11)
        Me.panel1.Controls.Add(Me.cbAllowTls10)
        Me.panel1.Controls.Add(Me.label23)
        Me.panel1.Controls.Add(Me.label22)
        Me.panel1.Dock = System.Windows.Forms.DockStyle.Top
        Me.panel1.Location = New System.Drawing.Point(3, 152)
        Me.panel1.Name = "panel1"
        Me.panel1.Size = New System.Drawing.Size(606, 67)
        Me.panel1.TabIndex = 45
        '
        'cmbSuites
        '
        Me.cmbSuites.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSuites.FormattingEnabled = True
        Me.cmbSuites.Items.AddRange(New Object() {"All ciphers", "Secure only"})
        Me.cmbSuites.Location = New System.Drawing.Point(122, 32)
        Me.cmbSuites.Name = "cmbSuites"
        Me.cmbSuites.Size = New System.Drawing.Size(117, 21)
        Me.cmbSuites.TabIndex = 6
        '
        'cbAllowTls13
        '
        Me.cbAllowTls13.AutoSize = True
        Me.cbAllowTls13.Checked = True
        Me.cbAllowTls13.CheckState = System.Windows.Forms.CheckState.Checked
        Me.cbAllowTls13.Location = New System.Drawing.Point(122, 10)
        Me.cbAllowTls13.Name = "cbAllowTls13"
        Me.cbAllowTls13.Size = New System.Drawing.Size(64, 17)
        Me.cbAllowTls13.TabIndex = 2
        Me.cbAllowTls13.Text = "TLS 1.3"
        Me.cbAllowTls13.UseVisualStyleBackColor = True
        '
        'cbAllowTls12
        '
        Me.cbAllowTls12.AutoSize = True
        Me.cbAllowTls12.Checked = True
        Me.cbAllowTls12.CheckState = System.Windows.Forms.CheckState.Checked
        Me.cbAllowTls12.Location = New System.Drawing.Point(192, 10)
        Me.cbAllowTls12.Name = "cbAllowTls12"
        Me.cbAllowTls12.Size = New System.Drawing.Size(64, 17)
        Me.cbAllowTls12.TabIndex = 3
        Me.cbAllowTls12.Text = "TLS 1.2"
        Me.cbAllowTls12.UseVisualStyleBackColor = True
        '
        'cbAllowTls11
        '
        Me.cbAllowTls11.AutoSize = True
        Me.cbAllowTls11.Location = New System.Drawing.Point(262, 10)
        Me.cbAllowTls11.Name = "cbAllowTls11"
        Me.cbAllowTls11.Size = New System.Drawing.Size(64, 17)
        Me.cbAllowTls11.TabIndex = 4
        Me.cbAllowTls11.Text = "TLS 1.1"
        Me.cbAllowTls11.UseVisualStyleBackColor = True
        '
        'cbAllowTls10
        '
        Me.cbAllowTls10.AutoSize = True
        Me.cbAllowTls10.Location = New System.Drawing.Point(332, 10)
        Me.cbAllowTls10.Name = "cbAllowTls10"
        Me.cbAllowTls10.Size = New System.Drawing.Size(64, 17)
        Me.cbAllowTls10.TabIndex = 5
        Me.cbAllowTls10.Text = "TLS 1.0"
        Me.cbAllowTls10.UseVisualStyleBackColor = True
        '
        'label23
        '
        Me.label23.AutoSize = True
        Me.label23.Location = New System.Drawing.Point(6, 35)
        Me.label23.Name = "label23"
        Me.label23.Size = New System.Drawing.Size(77, 13)
        Me.label23.TabIndex = 1
        Me.label23.Text = "Allowed suites:"
        '
        'label22
        '
        Me.label22.AutoSize = True
        Me.label22.Location = New System.Drawing.Point(6, 10)
        Me.label22.Name = "label22"
        Me.label22.Size = New System.Drawing.Size(88, 13)
        Me.label22.TabIndex = 0
        Me.label22.Text = "Allowed protocol:"
        '
        'pnlServerCertificate
        '
        Me.pnlServerCertificate.BackColor = System.Drawing.Color.Transparent
        Me.pnlServerCertificate.Controls.Add(Me.pnlLocalyStoredCertificate)
        Me.pnlServerCertificate.Controls.Add(Me.rbServerCertificateAny)
        Me.pnlServerCertificate.Controls.Add(Me.rbServerCertificateStored)
        Me.pnlServerCertificate.Controls.Add(Me.rbServerCertificateWindows)
        Me.pnlServerCertificate.Controls.Add(Me.label7)
        Me.pnlServerCertificate.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlServerCertificate.Location = New System.Drawing.Point(3, 3)
        Me.pnlServerCertificate.Name = "pnlServerCertificate"
        Me.pnlServerCertificate.Size = New System.Drawing.Size(606, 149)
        Me.pnlServerCertificate.TabIndex = 43
        '
        'pnlLocalyStoredCertificate
        '
        Me.pnlLocalyStoredCertificate.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.pnlLocalyStoredCertificate.Controls.Add(Me.label9)
        Me.pnlLocalyStoredCertificate.Controls.Add(Me.tbServerCertificateThumbprint)
        Me.pnlLocalyStoredCertificate.Controls.Add(Me.label10)
        Me.pnlLocalyStoredCertificate.Location = New System.Drawing.Point(140, 67)
        Me.pnlLocalyStoredCertificate.Name = "pnlLocalyStoredCertificate"
        Me.pnlLocalyStoredCertificate.Size = New System.Drawing.Size(463, 79)
        Me.pnlLocalyStoredCertificate.TabIndex = 41
        '
        'label9
        '
        Me.label9.AutoSize = True
        Me.label9.Location = New System.Drawing.Point(3, 19)
        Me.label9.Name = "label9"
        Me.label9.Size = New System.Drawing.Size(60, 13)
        Me.label9.TabIndex = 46
        Me.label9.Text = "(SH1 hash)"
        '
        'tbServerCertificateThumbprint
        '
        Me.tbServerCertificateThumbprint.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbServerCertificateThumbprint.Location = New System.Drawing.Point(90, 3)
        Me.tbServerCertificateThumbprint.Multiline = True
        Me.tbServerCertificateThumbprint.Name = "tbServerCertificateThumbprint"
        Me.tbServerCertificateThumbprint.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.tbServerCertificateThumbprint.Size = New System.Drawing.Size(371, 73)
        Me.tbServerCertificateThumbprint.TabIndex = 45
        '
        'label10
        '
        Me.label10.AutoSize = True
        Me.label10.Location = New System.Drawing.Point(3, 6)
        Me.label10.Name = "label10"
        Me.label10.Size = New System.Drawing.Size(57, 13)
        Me.label10.TabIndex = 42
        Me.label10.Text = "Thumbrint:"
        '
        'rbServerCertificateAny
        '
        Me.rbServerCertificateAny.AutoSize = True
        Me.rbServerCertificateAny.Location = New System.Drawing.Point(122, 1)
        Me.rbServerCertificateAny.Name = "rbServerCertificateAny"
        Me.rbServerCertificateAny.Size = New System.Drawing.Size(128, 17)
        Me.rbServerCertificateAny.TabIndex = 31
        Me.rbServerCertificateAny.Text = "Accept any certificate"
        Me.rbServerCertificateAny.UseVisualStyleBackColor = True
        '
        'rbServerCertificateStored
        '
        Me.rbServerCertificateStored.AutoSize = True
        Me.rbServerCertificateStored.Location = New System.Drawing.Point(122, 47)
        Me.rbServerCertificateStored.Name = "rbServerCertificateStored"
        Me.rbServerCertificateStored.Size = New System.Drawing.Size(195, 17)
        Me.rbServerCertificateStored.TabIndex = 33
        Me.rbServerCertificateStored.Text = "Trust localy stored server certificate:"
        Me.rbServerCertificateStored.UseVisualStyleBackColor = True
        '
        'rbServerCertificateWindows
        '
        Me.rbServerCertificateWindows.AutoSize = True
        Me.rbServerCertificateWindows.Checked = True
        Me.rbServerCertificateWindows.Location = New System.Drawing.Point(122, 24)
        Me.rbServerCertificateWindows.Name = "rbServerCertificateWindows"
        Me.rbServerCertificateWindows.Size = New System.Drawing.Size(209, 17)
        Me.rbServerCertificateWindows.TabIndex = 32
        Me.rbServerCertificateWindows.TabStop = True
        Me.rbServerCertificateWindows.Text = "Use Windows certificates infrastructure"
        Me.rbServerCertificateWindows.UseVisualStyleBackColor = True
        '
        'label7
        '
        Me.label7.AutoSize = True
        Me.label7.Location = New System.Drawing.Point(6, 3)
        Me.label7.Name = "label7"
        Me.label7.Size = New System.Drawing.Size(90, 26)
        Me.label7.TabIndex = 9
        Me.label7.Text = "Server certificate " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "validation:"
        '
        'tabSsh
        '
        Me.tabSsh.Controls.Add(Me.pnlServerKey)
        Me.tabSsh.Location = New System.Drawing.Point(4, 22)
        Me.tabSsh.Name = "tabSsh"
        Me.tabSsh.Padding = New System.Windows.Forms.Padding(3)
        Me.tabSsh.Size = New System.Drawing.Size(612, 331)
        Me.tabSsh.TabIndex = 3
        Me.tabSsh.Text = "SSH"
        '
        'pnlServerKey
        '
        Me.pnlServerKey.BackColor = System.Drawing.Color.Transparent
        Me.pnlServerKey.Controls.Add(Me.cmbSshSuites)
        Me.pnlServerKey.Controls.Add(Me.Label24)
        Me.pnlServerKey.Controls.Add(Me.pnlLocalyStoredKey)
        Me.pnlServerKey.Controls.Add(Me.rbServerKeyAny)
        Me.pnlServerKey.Controls.Add(Me.rbServerKeyStored)
        Me.pnlServerKey.Controls.Add(Me.label17)
        Me.pnlServerKey.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlServerKey.Location = New System.Drawing.Point(3, 3)
        Me.pnlServerKey.Name = "pnlServerKey"
        Me.pnlServerKey.Size = New System.Drawing.Size(606, 184)
        Me.pnlServerKey.TabIndex = 44
        '
        'cmbSshSuites
        '
        Me.cmbSshSuites.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbSshSuites.FormattingEnabled = True
        Me.cmbSshSuites.Items.AddRange(New Object() {"All ciphers", "Secure only"})
        Me.cmbSshSuites.Location = New System.Drawing.Point(140, 157)
        Me.cmbSshSuites.Name = "cmbSshSuites"
        Me.cmbSshSuites.Size = New System.Drawing.Size(117, 21)
        Me.cmbSshSuites.TabIndex = 43
        '
        'Label24
        '
        Me.Label24.AutoSize = True
        Me.Label24.Location = New System.Drawing.Point(6, 160)
        Me.Label24.Name = "Label24"
        Me.Label24.Size = New System.Drawing.Size(77, 13)
        Me.Label24.TabIndex = 42
        Me.Label24.Text = "Allowed suites:"
        '
        'pnlLocalyStoredKey
        '
        Me.pnlLocalyStoredKey.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.pnlLocalyStoredKey.Controls.Add(Me.label21)
        Me.pnlLocalyStoredKey.Controls.Add(Me.label20)
        Me.pnlLocalyStoredKey.Controls.Add(Me.cmbServerKeyAlgorithm)
        Me.pnlLocalyStoredKey.Controls.Add(Me.label18)
        Me.pnlLocalyStoredKey.Controls.Add(Me.tbServerKeyFingerprint)
        Me.pnlLocalyStoredKey.Controls.Add(Me.cmbServerKeyHashAlgorithm)
        Me.pnlLocalyStoredKey.Controls.Add(Me.label15)
        Me.pnlLocalyStoredKey.Controls.Add(Me.label16)
        Me.pnlLocalyStoredKey.Location = New System.Drawing.Point(140, 44)
        Me.pnlLocalyStoredKey.Name = "pnlLocalyStoredKey"
        Me.pnlLocalyStoredKey.Size = New System.Drawing.Size(463, 108)
        Me.pnlLocalyStoredKey.TabIndex = 41
        '
        'label21
        '
        Me.label21.AutoSize = True
        Me.label21.Location = New System.Drawing.Point(4, 75)
        Me.label21.Name = "label21"
        Me.label21.Size = New System.Drawing.Size(59, 13)
        Me.label21.TabIndex = 53
        Me.label21.Text = "(fingerprint)"
        '
        'label20
        '
        Me.label20.AutoSize = True
        Me.label20.Location = New System.Drawing.Point(217, 6)
        Me.label20.Name = "label20"
        Me.label20.Size = New System.Drawing.Size(143, 13)
        Me.label20.TabIndex = 52
        Me.label20.Text = "(preferred host key algorithm)"
        '
        'cmbServerKeyAlgorithm
        '
        Me.cmbServerKeyAlgorithm.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbServerKeyAlgorithm.FormattingEnabled = True
        Me.cmbServerKeyAlgorithm.Location = New System.Drawing.Point(90, 3)
        Me.cmbServerKeyAlgorithm.Name = "cmbServerKeyAlgorithm"
        Me.cmbServerKeyAlgorithm.Size = New System.Drawing.Size(121, 21)
        Me.cmbServerKeyAlgorithm.TabIndex = 41
        '
        'label18
        '
        Me.label18.AutoSize = True
        Me.label18.Location = New System.Drawing.Point(4, 6)
        Me.label18.Name = "label18"
        Me.label18.Size = New System.Drawing.Size(73, 13)
        Me.label18.TabIndex = 51
        Me.label18.Text = "Key algorithm:"
        '
        'tbServerKeyFingerprint
        '
        Me.tbServerKeyFingerprint.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.tbServerKeyFingerprint.Location = New System.Drawing.Point(89, 59)
        Me.tbServerKeyFingerprint.Multiline = True
        Me.tbServerKeyFingerprint.Name = "tbServerKeyFingerprint"
        Me.tbServerKeyFingerprint.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.tbServerKeyFingerprint.Size = New System.Drawing.Size(371, 46)
        Me.tbServerKeyFingerprint.TabIndex = 47
        '
        'cmbServerKeyHashAlgorithm
        '
        Me.cmbServerKeyHashAlgorithm.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.cmbServerKeyHashAlgorithm.FormattingEnabled = True
        Me.cmbServerKeyHashAlgorithm.Location = New System.Drawing.Point(90, 30)
        Me.cmbServerKeyHashAlgorithm.Name = "cmbServerKeyHashAlgorithm"
        Me.cmbServerKeyHashAlgorithm.Size = New System.Drawing.Size(121, 21)
        Me.cmbServerKeyHashAlgorithm.TabIndex = 45
        '
        'label15
        '
        Me.label15.AutoSize = True
        Me.label15.Location = New System.Drawing.Point(4, 62)
        Me.label15.Name = "label15"
        Me.label15.Size = New System.Drawing.Size(64, 13)
        Me.label15.TabIndex = 42
        Me.label15.Text = "Hash value:"
        '
        'label16
        '
        Me.label16.AutoSize = True
        Me.label16.Location = New System.Drawing.Point(4, 33)
        Me.label16.Name = "label16"
        Me.label16.Size = New System.Drawing.Size(80, 13)
        Me.label16.TabIndex = 41
        Me.label16.Text = "Hash algorithm:"
        '
        'rbServerKeyAny
        '
        Me.rbServerKeyAny.AutoSize = True
        Me.rbServerKeyAny.Location = New System.Drawing.Point(122, 1)
        Me.rbServerKeyAny.Name = "rbServerKeyAny"
        Me.rbServerKeyAny.Size = New System.Drawing.Size(99, 17)
        Me.rbServerKeyAny.TabIndex = 31
        Me.rbServerKeyAny.Text = "Accept any key"
        Me.rbServerKeyAny.UseVisualStyleBackColor = True
        '
        'rbServerKeyStored
        '
        Me.rbServerKeyStored.AutoSize = True
        Me.rbServerKeyStored.Checked = True
        Me.rbServerKeyStored.Location = New System.Drawing.Point(122, 24)
        Me.rbServerKeyStored.Name = "rbServerKeyStored"
        Me.rbServerKeyStored.Size = New System.Drawing.Size(166, 17)
        Me.rbServerKeyStored.TabIndex = 33
        Me.rbServerKeyStored.TabStop = True
        Me.rbServerKeyStored.Text = "Trust localy stored server key:"
        Me.rbServerKeyStored.UseVisualStyleBackColor = True
        '
        'label17
        '
        Me.label17.AutoSize = True
        Me.label17.Location = New System.Drawing.Point(6, 3)
        Me.label17.Name = "label17"
        Me.label17.Size = New System.Drawing.Size(61, 26)
        Me.label17.TabIndex = 9
        Me.label17.Text = "Server key " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "validation:"
        '
        'UcConnectionEditor
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.Controls.Add(Me.tabControlMain)
        Me.MinimumSize = New System.Drawing.Size(620, 0)
        Me.Name = "UcConnectionEditor"
        Me.Size = New System.Drawing.Size(620, 357)
        Me.tabControlMain.ResumeLayout(False)
        Me.tabServer.ResumeLayout(False)
        Me.grpCredentials.ResumeLayout(False)
        Me.pnlClearCommandChannel.ResumeLayout(False)
        Me.pnlClearCommandChannel.PerformLayout()
        Me.pnlPrivateKey.ResumeLayout(False)
        Me.pnlPrivateKey.PerformLayout()
        Me.pnlClientCertificate.ResumeLayout(False)
        Me.pnlClientCertificate.PerformLayout()
        Me.pnlDomain.ResumeLayout(False)
        Me.pnlDomain.PerformLayout()
        Me.pnlUsernamePassword.ResumeLayout(False)
        Me.pnlUsernamePassword.PerformLayout()
        Me.grpConnection.ResumeLayout(False)
        Me.pnlHostnameProtocol.ResumeLayout(False)
        Me.pnlHostnameProtocol.PerformLayout()
        Me.tabProxy.ResumeLayout(False)
        Me.pnlProxy.ResumeLayout(False)
        Me.pnlProxy.PerformLayout()
        Me.tabSsl.ResumeLayout(False)
        Me.panel1.ResumeLayout(False)
        Me.panel1.PerformLayout()
        Me.pnlServerCertificate.ResumeLayout(False)
        Me.pnlServerCertificate.PerformLayout()
        Me.pnlLocalyStoredCertificate.ResumeLayout(False)
        Me.pnlLocalyStoredCertificate.PerformLayout()
        Me.tabSsh.ResumeLayout(False)
        Me.pnlServerKey.ResumeLayout(False)
        Me.pnlServerKey.PerformLayout()
        Me.pnlLocalyStoredKey.ResumeLayout(False)
        Me.pnlLocalyStoredKey.PerformLayout()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private label8 As System.Windows.Forms.Label
    Private WithEvents btnClearClientCertificate As System.Windows.Forms.Button
    Private tbClientCertificate As System.Windows.Forms.TextBox
    Private WithEvents btnImportClientCertificate As System.Windows.Forms.Button
    Private cbClearCommandChannel As System.Windows.Forms.CheckBox
    Private cbPassive As System.Windows.Forms.CheckBox
    Private tbServerPort As System.Windows.Forms.TextBox
    Private label3 As System.Windows.Forms.Label
    Private label1 As System.Windows.Forms.Label
    Private WithEvents cmbProtocol As System.Windows.Forms.ComboBox
    Private WithEvents tbServerHost As System.Windows.Forms.TextBox
    Private label2 As System.Windows.Forms.Label
    Private pnlServerCertificate As System.Windows.Forms.Panel
    Private rbServerCertificateWindows As System.Windows.Forms.RadioButton
    Private label7 As System.Windows.Forms.Label
    Private lblPrivateKey As System.Windows.Forms.Label
    Private WithEvents btnClearPrivateKey As System.Windows.Forms.Button
    Private tbPrivateKey As System.Windows.Forms.TextBox
    Private WithEvents btnImportPrivateKey As System.Windows.Forms.Button
    Private tbServerUser As System.Windows.Forms.TextBox
    Private label4 As System.Windows.Forms.Label
    Private label5 As System.Windows.Forms.Label
    Private tbServerPassword As System.Windows.Forms.TextBox
    Protected pnlClientCertificate As System.Windows.Forms.Panel
    Protected pnlPrivateKey As System.Windows.Forms.Panel
    Protected grpCredentials As System.Windows.Forms.GroupBox
    Protected grpConnection As System.Windows.Forms.GroupBox
    Protected pnlHostnameProtocol As System.Windows.Forms.Panel
    Protected pnlUsernamePassword As System.Windows.Forms.Panel
    Protected pnlClearCommandChannel As System.Windows.Forms.Panel
    Protected tabServer As System.Windows.Forms.TabPage
    Protected tabProxy As System.Windows.Forms.TabPage
    Protected tabSsl As System.Windows.Forms.TabPage
    Protected tabSsh As System.Windows.Forms.TabPage
    Private rbServerCertificateAny As System.Windows.Forms.RadioButton
    Private pnlLocalyStoredCertificate As System.Windows.Forms.Panel
    Private tbServerCertificateThumbprint As System.Windows.Forms.TextBox
    Private label10 As System.Windows.Forms.Label
    Protected tabControlMain As System.Windows.Forms.TabControl
    Protected WithEvents rbServerCertificateStored As System.Windows.Forms.RadioButton
    Private pnlServerKey As System.Windows.Forms.Panel
    Private pnlLocalyStoredKey As System.Windows.Forms.Panel
    Private tbServerKeyFingerprint As System.Windows.Forms.TextBox
    Private WithEvents cmbServerKeyHashAlgorithm As System.Windows.Forms.ComboBox
    Private label15 As System.Windows.Forms.Label
    Private label16 As System.Windows.Forms.Label
    Private rbServerKeyAny As System.Windows.Forms.RadioButton
    Protected WithEvents rbServerKeyStored As System.Windows.Forms.RadioButton
    Private label17 As System.Windows.Forms.Label
    Private cmbServerKeyAlgorithm As System.Windows.Forms.ComboBox
    Private label18 As System.Windows.Forms.Label
    Private WithEvents btnViewClientCertificate As System.Windows.Forms.Button
    Protected pnlProxy As System.Windows.Forms.Panel
    Private tbProxyPort As System.Windows.Forms.TextBox
    Private label6 As System.Windows.Forms.Label
    Private label11 As System.Windows.Forms.Label
    Private WithEvents cmbProxyType As System.Windows.Forms.ComboBox
    Private tbProxyHost As System.Windows.Forms.TextBox
    Private label12 As System.Windows.Forms.Label
    Private tbProxyUsername As System.Windows.Forms.TextBox
    Private label13 As System.Windows.Forms.Label
    Private label14 As System.Windows.Forms.Label
    Private tbProxyPassword As System.Windows.Forms.TextBox
    Private label19 As System.Windows.Forms.Label
    Private cbStorePassword As System.Windows.Forms.CheckBox
    Private WithEvents cbUseGssApi As System.Windows.Forms.CheckBox
    Private lblDomain As System.Windows.Forms.Label
    Private tbServerDomain As System.Windows.Forms.TextBox
    Protected pnlDomain As System.Windows.Forms.Panel
    Private label9 As System.Windows.Forms.Label
    Private label21 As System.Windows.Forms.Label
    Private label20 As System.Windows.Forms.Label

End Class
