HostKeyEventArgs
Provides data for the HostKeyReceived event.
using Renci.SshNet.Abstractions;
using Renci.SshNet.Security;
using SshNet.Security.Cryptography;
using System;
using System.Security.Cryptography;
namespace Renci.SshNet.Common
{
public class HostKeyEventArgs : EventArgs
{
public bool CanTrust { get; set; }
public byte[] HostKey { get; set; }
public string HostKeyName { get; set; }
public byte[] FingerPrint { get; set; }
public int KeyLength { get; set; }
public HostKeyEventArgs(KeyHostAlgorithm host)
{
CanTrust = true;
HostKey = host.Data;
HostKeyName = host.Name;
KeyLength = host.Key.KeyLength;
MD5 val = CryptoAbstraction.CreateMD5();
try {
FingerPrint = ((HashAlgorithm)val).ComputeHash(host.Data);
} finally {
((IDisposable)val)?.Dispose();
}
}
}
}