PuttyTools.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //---------------------------------------------------------------------------
  2. #ifndef PuttyToolsH
  3. #define PuttyToolsH
  4. //---------------------------------------------------------------------------
  5. #include <SessionData.h>
  6. //---------------------------------------------------------------------------
  7. enum TKeyType
  8. {
  9. ktUnopenable, ktUnknown,
  10. ktSSH1, ktSSH2,
  11. ktOpenSSHAuto, ktOpenSSHPEM, ktOpenSSHNew, ktSSHCom,
  12. ktSSH1Public, ktSSH2PublicRFC4716, ktSSH2PublicOpenSSH
  13. };
  14. TKeyType KeyType(UnicodeString FileName);
  15. bool IsKeyEncrypted(TKeyType KeyType, const UnicodeString & FileName, UnicodeString & Comment);
  16. struct TPrivateKey;
  17. TPrivateKey * LoadKey(TKeyType KeyType, const UnicodeString & FileName, const UnicodeString & Passphrase);
  18. UnicodeString TestKey(TKeyType KeyType, const UnicodeString & FileName);
  19. void ChangeKeyComment(TPrivateKey * PrivateKey, const UnicodeString & Comment);
  20. void AddCertificateToKey(TPrivateKey * PrivateKey, const UnicodeString & CertificateFileName);
  21. void SaveKey(TKeyType KeyType, const UnicodeString & FileName,
  22. const UnicodeString & Passphrase, TPrivateKey * PrivateKey);
  23. void FreeKey(TPrivateKey * PrivateKey);
  24. UnicodeString GetPublicKeyLine(const UnicodeString & FileName, UnicodeString & Comment, bool & HasCertificate);
  25. extern const UnicodeString PuttyKeyExt;
  26. //---------------------------------------------------------------------------
  27. bool __fastcall HasGSSAPI(UnicodeString CustomPath);
  28. //---------------------------------------------------------------------------
  29. void __fastcall AES256EncodeWithMAC(char * Data, size_t Len, const char * Password,
  30. size_t PasswordLen, const char * Salt);
  31. //---------------------------------------------------------------------------
  32. void __fastcall NormalizeFingerprint(UnicodeString & Fingerprint, UnicodeString & KeyName);
  33. UnicodeString __fastcall KeyTypeFromFingerprint(UnicodeString Fingerprint);
  34. //---------------------------------------------------------------------------
  35. UnicodeString __fastcall GetPuTTYVersion();
  36. //---------------------------------------------------------------------------
  37. UnicodeString __fastcall Sha256(const char * Data, size_t Size);
  38. //---------------------------------------------------------------------------
  39. void __fastcall DllHijackingProtection();
  40. //---------------------------------------------------------------------------
  41. UnicodeString __fastcall ParseOpenSshPubLine(const UnicodeString & Line, const struct ssh_keyalg *& Algorithm);
  42. //---------------------------------------------------------------------------
  43. UnicodeString __fastcall GetKeyTypeHuman(const UnicodeString & KeyType);
  44. //---------------------------------------------------------------------------
  45. bool IsOpenSSH(const UnicodeString & SshImplementation);
  46. //---------------------------------------------------------------------------
  47. TStrings * SshCipherList();
  48. TStrings * SshKexList();
  49. int HostKeyToPutty(THostKey HostKey);
  50. TStrings * SshHostKeyList();
  51. TStrings * SshMacList();
  52. //---------------------------------------------------------------------------
  53. class TSessionData;
  54. void SaveAsPutty(const UnicodeString & Name, TSessionData * Data);
  55. class THierarchicalStorage;
  56. void WritePuttySettings(THierarchicalStorage * Storage, const UnicodeString & Settings);
  57. void SavePuttyDefaults(const UnicodeString & Name);
  58. //---------------------------------------------------------------------------
  59. bool RandomSeedExists();
  60. //---------------------------------------------------------------------------
  61. #endif