HostKeyEventArgs.cs 704 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Renci.SshNet.Security.Cryptography;
  6. namespace Renci.SshNet.Common
  7. {
  8. public class HostKeyEventArgs : EventArgs
  9. {
  10. public bool CanTrust { get; set; }
  11. public byte[] HostKey { get; private set; }
  12. public byte[] FingerPrint { get; private set; }
  13. public HostKeyEventArgs(byte[] hostKey)
  14. {
  15. this.CanTrust = true; // Set default value
  16. this.HostKey = hostKey;
  17. using (var md5 = new MD5Hash())
  18. {
  19. this.FingerPrint = md5.ComputeHash(hostKey);
  20. }
  21. }
  22. }
  23. }