HostAlgorithm.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Renci.SshNet.Common;
  6. using Renci.SshNet.Security.Cryptography;
  7. namespace Renci.SshNet.Security
  8. {
  9. /// <summary>
  10. /// Base class for SSH host algorithms.
  11. /// </summary>
  12. public abstract class HostAlgorithm
  13. {
  14. /// <summary>
  15. /// Gets the host key name.
  16. /// </summary>
  17. public string Name { get; private set; }
  18. /// <summary>
  19. /// Gets the host key data.
  20. /// </summary>
  21. public abstract byte[] Data { get; }
  22. /// <summary>
  23. /// Initializes a new instance of the <see cref="HostAlgorithm"/> class.
  24. /// </summary>
  25. /// <param name="name">The host key name.</param>
  26. public HostAlgorithm(string name)
  27. {
  28. this.Name = name;
  29. }
  30. /// <summary>
  31. /// Signs the specified data.
  32. /// </summary>
  33. /// <param name="data">The data.</param>
  34. /// <returns></returns>
  35. public abstract byte[] Sign(byte[] data);
  36. /// <summary>
  37. /// Verifies the signature.
  38. /// </summary>
  39. /// <param name="data">The data.</param>
  40. /// <param name="signature">The signature.</param>
  41. /// <returns></returns>
  42. public abstract bool VerifySignature(byte[] data, byte[] signature);
  43. }
  44. }