PrivateKey.cs 1012 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections.Generic;
  2. using Renci.SshClient.Common;
  3. namespace Renci.SshClient.Security
  4. {
  5. internal abstract class PrivateKey
  6. {
  7. public abstract string AlgorithmName { get; }
  8. protected IEnumerable<byte> Data { get; private set; }
  9. public abstract IEnumerable<byte> PublicKey { get; }
  10. public PrivateKey(IEnumerable<byte> data)
  11. {
  12. this.Data = data;
  13. }
  14. public abstract IEnumerable<byte> GetSignature(IEnumerable<byte> sessionId);
  15. protected class SignatureKeyData : SshData
  16. {
  17. public string AlgorithmName { get; set; }
  18. public IEnumerable<byte> Signature { get; set; }
  19. protected override void LoadData()
  20. {
  21. }
  22. protected override void SaveData()
  23. {
  24. this.Write(this.AlgorithmName);
  25. this.Write(this.Signature.GetSshString());
  26. }
  27. }
  28. }
  29. }