Exemplo n.º 1
0
        public IHostKeyAlgorithm PickHostKeyAlgorithm()
        {
            foreach (string algo in this.ServerHostKeyAlgorithms)
            {
                IHostKeyAlgorithm selectedAlgo = Server.GetType <IHostKeyAlgorithm>(Server.SupportedHostKeyAlgorithms, algo);
                if (selectedAlgo != null)
                {
                    return(selectedAlgo);
                }
            }

            // If no algorithm satisfying all these conditions can be found, the
            // connection fails, and both sides MUST disconnect.
            throw new SSHServerException(DisconnectReason.SSH_DISCONNECT_KEY_EXCHANGE_FAILED, "Could not find a shared Host Key Algorithm");
        }
Exemplo n.º 2
0
        public IHostKeyAlgorithm PickHostKeyAlgorithm()
        {
            foreach (string algo in this.ServerHostKeyAlgorithms)
            {
                IHostKeyAlgorithm selectedAlgo = Server.GetType <IHostKeyAlgorithm>(Server.SupportedHostKeyAlgorithms, algo);

                if (selectedAlgo != null)
                {
                    return(selectedAlgo);
                }
            }

            // If no algorithm satisfying all these conditions can be found, the
            // connection fails, and both sides MUST disconnect.
            throw new NotSupportedException("Could not find a shared Host Key Algorithm");
        }