Provides data for the HostKeyReceived event.
Inheritance: System.EventArgs
Exemplo n.º 1
0
 public void CanTrustTest()
 {
     KeyHostAlgorithm host = null; // TODO: Initialize to an appropriate value
     HostKeyEventArgs target = new HostKeyEventArgs(host); // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     target.CanTrust = expected;
     actual = target.CanTrust;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemplo n.º 2
0
 private void Session_HostKeyReceived(object sender, HostKeyEventArgs e)
 {
     var handler = HostKeyReceived;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Determines whether the specified host key can be trusted.
        /// </summary>
        /// <param name="host">The host algorithm.</param>
        /// <returns>
        ///   <c>true</c> if the specified host can be trusted; otherwise, <c>false</c>.
        /// </returns>
        protected bool CanTrustHostKey(KeyHostAlgorithm host)
        {
            var args = new HostKeyEventArgs(host);

            if (this.HostKeyReceived != null)
            {
                this.HostKeyReceived(this, args);
            }

            return args.CanTrust;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Determines whether the specified host key can be trusted.
        /// </summary>
        /// <param name="host">The host algorithm.</param>
        /// <returns>
        /// <c>true</c> if the specified host can be trusted; otherwise, <c>false</c>.
        /// </returns>
        protected bool CanTrustHostKey(KeyHostAlgorithm host)
        {
            var handlers = HostKeyReceived;
            if (handlers != null)
            {
                var args = new HostKeyEventArgs(host);
                handlers(this, args);
                return args.CanTrust;
            }

            return true;
        }
Exemplo n.º 5
0
 private void sftp_HostKeyReceived(object sender, HostKeyEventArgs e)
 {
     LogDelegate("[SFTP] HostKeyReceived : " + e.HostKeyName + " " + e.HostKey);
 }
Exemplo n.º 6
0
 private void Session_HostKeyReceived(object sender, HostKeyEventArgs e)
 {
     if (this.HostKeyReceived != null)
     {
         this.HostKeyReceived(this, e);
     }
 }
Exemplo n.º 7
0
 public void HostKeyEventArgsConstructorTest()
 {
     KeyHostAlgorithm host = null; // TODO: Initialize to an appropriate value
     HostKeyEventArgs target = new HostKeyEventArgs(host);
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
Exemplo n.º 8
0
 private void SshClient_HostKeyReceived(object sender, Renci.SshNet.Common.HostKeyEventArgs e)
 {
     Info("Host key fingerprint is: {0} {1}.", e.HostKeyName, BitConverter.ToString(e.FingerPrint).Replace('-', ':').ToLower());
 }
Exemplo n.º 9
0
 private void M_Client_HostKeyReceived(object sender, Renci.SshNet.Common.HostKeyEventArgs e)
 {
     e.CanTrust = e.FingerPrint.SequenceEqual(m_fingerprint) ? true : false;
 }
Exemplo n.º 10
0
 /// <summary>
 /// An event handler called when the host key was received for the current SSH connection.
 /// </summary>
 /// <param name="sender">The sender object.</param>
 /// <param name="e">The event arguments.</param>
 private void OnSshHostKeyReceived(object sender, HostKeyEventArgs e)
 {
     // Execute the code on the UI thread.
     this.Invoke(() =>
         {
             this.OnHostKeyReceivedInternal(e);
         });
 }
Exemplo n.º 11
0
 /// <summary>
 /// An action called when receiving the key from the remote host.
 /// </summary>
 /// <param name="args">The arguments.</param>
 private void OnHostKeyReceivedInternal(HostKeyEventArgs args)
 {
     // Call the event handler.
     this.OnHostKeyReceived(this.client.ConnectionInfo, args);
 }
Exemplo n.º 12
0
 /// <summary>
 /// An event handler called when receiving a key from the remote host.
 /// </summary>
 /// <param name="info">The connection info.</param>
 /// <param name="args">The event arguments.</param>
 protected virtual void OnHostKeyReceived(ConnectionInfo info, HostKeyEventArgs args)
 {
 }
Exemplo n.º 13
0
 /// <summary>
 /// An event handler called when receiving a key from the remote host.
 /// </summary>
 /// <param name="info">The connection info.</param>
 /// <param name="args">The event arguments.</param>
 protected override void OnHostKeyReceived(ConnectionInfo info, HostKeyEventArgs args)
 {
     // Log
     this.log.Add(this.config.Api.Log(
         LogEventLevel.Verbose,
         LogEventType.Information,
         "The client connected to the SSH server \'{0}\' received key \'{1}\' of {2} bits. Key: {3}. Fingerprint: {4}.",
         new object[] { info.Host, args.HostKeyName, args.KeyLength, args.HostKey, args.FingerPrint }));
 }
Exemplo n.º 14
0
 /// <summary>
 /// An event handler called when receiving a key from the remote host.
 /// </summary>
 /// <param name="info">The connection info.</param>
 /// <param name="args">The event arguments.</param>
 protected override void OnHostKeyReceived(ConnectionInfo info, HostKeyEventArgs args)
 {
     // Log
     this.log.Add(this.crawler.Log.Add(
         LogEventLevel.Verbose,
         LogEventType.Information,
         ControlSession.logSource,
         "The client connected to the PlanetLab node \'{0}\' received key \'{1}\' of {2} bits. Key: {3}. Fingerprint: {4}.",
         new object[] { info.Host, args.HostKeyName, args.KeyLength, args.HostKey, args.FingerPrint }));
 }