KeyExchangeAlgorithm.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. namespace Renci.SshNet.TestTools.OpenSSH
  2. {
  3. public sealed class KeyExchangeAlgorithm
  4. {
  5. public static readonly KeyExchangeAlgorithm DiffieHellmanGroup1Sha1 = new KeyExchangeAlgorithm("diffie-hellman-group1-sha1");
  6. public static readonly KeyExchangeAlgorithm DiffieHellmanGroup14Sha1 = new KeyExchangeAlgorithm("diffie-hellman-group14-sha1");
  7. public static readonly KeyExchangeAlgorithm DiffieHellmanGroup14Sha256 = new KeyExchangeAlgorithm("diffie-hellman-group14-sha256");
  8. public static readonly KeyExchangeAlgorithm DiffieHellmanGroup16Sha512 = new KeyExchangeAlgorithm("diffie-hellman-group16-sha512");
  9. public static readonly KeyExchangeAlgorithm DiffieHellmanGroup18Sha512 = new KeyExchangeAlgorithm("diffie-hellman-group18-sha512");
  10. public static readonly KeyExchangeAlgorithm DiffieHellmanGroupExchangeSha1 = new KeyExchangeAlgorithm("diffie-hellman-group-exchange-sha1");
  11. public static readonly KeyExchangeAlgorithm DiffieHellmanGroupExchangeSha256 = new KeyExchangeAlgorithm("diffie-hellman-group-exchange-sha256");
  12. public static readonly KeyExchangeAlgorithm EcdhSha2Nistp256 = new KeyExchangeAlgorithm("ecdh-sha2-nistp256");
  13. public static readonly KeyExchangeAlgorithm EcdhSha2Nistp384 = new KeyExchangeAlgorithm("ecdh-sha2-nistp384");
  14. public static readonly KeyExchangeAlgorithm EcdhSha2Nistp521 = new KeyExchangeAlgorithm("ecdh-sha2-nistp521");
  15. public static readonly KeyExchangeAlgorithm Curve25519Sha256 = new KeyExchangeAlgorithm("curve25519-sha256");
  16. public static readonly KeyExchangeAlgorithm Curve25519Sha256Libssh = new KeyExchangeAlgorithm("curve25519-sha256@libssh.org");
  17. public static readonly KeyExchangeAlgorithm SNtruP761X25519Sha512 = new KeyExchangeAlgorithm("sntrup761x25519-sha512");
  18. public static readonly KeyExchangeAlgorithm SNtruP761X25519Sha512OpenSsh = new KeyExchangeAlgorithm("sntrup761x25519-sha512@openssh.com");
  19. public KeyExchangeAlgorithm(string name)
  20. {
  21. Name = name;
  22. }
  23. public string Name { get; }
  24. public override bool Equals(object? obj)
  25. {
  26. if (obj == null)
  27. {
  28. return false;
  29. }
  30. if (obj is KeyExchangeAlgorithm otherKex)
  31. {
  32. return otherKex.Name == Name;
  33. }
  34. return false;
  35. }
  36. public override int GetHashCode()
  37. {
  38. return Name.GetHashCode();
  39. }
  40. public override string ToString()
  41. {
  42. return Name;
  43. }
  44. }
  45. }