KexAlgorithm.cs 552 B

12345678910111213141516171819202122
  1. using System.Diagnostics.Contracts;
  2. using System.Security.Cryptography;
  3. namespace FxSsh.Algorithms
  4. {
  5. [ContractClass(typeof(KexAlgorithmContract))]
  6. public abstract class KexAlgorithm
  7. {
  8. protected HashAlgorithm _hashAlgorithm;
  9. public abstract byte[] CreateKeyExchange();
  10. public abstract byte[] DecryptKeyExchange(byte[] exchangeData);
  11. public byte[] ComputeHash(byte[] input)
  12. {
  13. Contract.Requires(input != null);
  14. return _hashAlgorithm.ComputeHash(input);
  15. }
  16. }
  17. }