using System; using Renci.SshNet.Abstractions; using Renci.SshNet.Security; namespace Renci.SshNet.Common { /// /// Provides data for the HostKeyReceived event. /// public class HostKeyEventArgs : EventArgs { /// /// Gets or sets a value indicating whether host key can be trusted. /// /// /// true if host key can be trusted; otherwise, false. /// public bool CanTrust { get; set; } /// /// Gets the host key. /// public byte[] HostKey { get; private set; } /// /// Gets the host key name. /// public string HostKeyName{ get; private set; } /// /// Gets the finger print. /// public byte[] FingerPrint { get; private set; } /// /// Gets the length of the key in bits. /// /// /// The length of the key in bits. /// public int KeyLength { get; private set; } /// /// Initializes a new instance of the class. /// /// The host. public HostKeyEventArgs(KeyHostAlgorithm host) { CanTrust = true; HostKey = host.Data; HostKeyName = host.Name; KeyLength = host.Key.KeyLength; using (var md5 = CryptoAbstraction.CreateMD5()) { FingerPrint = md5.ComputeHash(host.Data); } } } }