Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.1 KiB

  1. // KeyManager.h: interface for the CKeyManagerHash class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(_KEYMANAGERHASH_H)
  5. #define _KEYMANAGERHASH_H
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #ifdef UNIX
  10. #include <des.h>
  11. // BUGBUG needs some headers to get MAC Address on unix
  12. #else
  13. #include "nt\des.h"
  14. #include "nt\tripldes.h"
  15. #include "nt\modes.h"
  16. #include <nb30.h>
  17. #endif
  18. class CKeyManagerHash
  19. {
  20. public:
  21. CKeyManagerHash();
  22. virtual ~CKeyManagerHash();
  23. typedef BYTE RAWKEY[24];
  24. typedef BYTE ENCKEY[56];
  25. HRESULT encryptKey(RAWKEY input, ENCKEY output);
  26. HRESULT decryptKey(ENCKEY input, RAWKEY output);
  27. BOOL isOk() { return m_ok; }
  28. protected:
  29. void LogBlob(LPBYTE pbBlob, DWORD dwBlobLen, LPCSTR pszCaption);
  30. void makeDESKey(LPBYTE pbKey, ULONG nKey);
  31. HRESULT LoadKeysFromWMI();
  32. BOOL m_ok;
  33. BOOL m_dwLoggingEnabled;
  34. #ifdef UNIX
  35. des_key_schedule ks1, ks2, ks3;
  36. #else
  37. unsigned long m_nKeys;
  38. unsigned long m_nEncryptKey;
  39. DES3TABLE* m_pks;
  40. #endif
  41. };
  42. #endif // !defined(AFX_KEYMANAGER_H__0AC10C43_D0D5_11D2_95E5_00C04F8E7A70__INCLUDED_)