KeyExchangeAlgorithm.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 Sntrup4591761x25519Sha512 = new KeyExchangeAlgorithm("sntrup4591761x25519-sha512@tinyssh.org");
  18. public KeyExchangeAlgorithm(string name)
  19. {
  20. Name = name;
  21. }
  22. public string Name { get; }
  23. public override bool Equals(object? obj)
  24. {
  25. if (obj == null)
  26. {
  27. return false;
  28. }
  29. if (obj is KeyExchangeAlgorithm otherKex)
  30. {
  31. return otherKex.Name == Name;
  32. }
  33. return false;
  34. }
  35. public override int GetHashCode()
  36. {
  37. return Name.GetHashCode();
  38. }
  39. public override string ToString()
  40. {
  41. return Name;
  42. }
  43. }
  44. }