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.

90 lines
2.8 KiB

  1. //
  2. // Microsoft Windows Media Technologies
  3. // Copyright (C) Microsoft Corporation, 1999 - 2001. All rights reserved.
  4. //
  5. #ifndef _CSECURECHANNELSERVER_H_2AD99357_6FD2_11d3_8497_00C04F79DBC0
  6. #define _CSECURECHANNELSERVER_H_2AD99357_6FD2_11d3_8497_00C04F79DBC0
  7. #include "wtypes.h"
  8. #ifdef USE_X509
  9. #include "rsa.h"
  10. #endif
  11. #include "des.h"
  12. #ifdef USE_X509
  13. #include "x509cert.h"
  14. #endif
  15. #include "sac.h"
  16. class CSecureChannelServer
  17. {
  18. public:
  19. CSecureChannelServer();
  20. ~CSecureChannelServer();
  21. HRESULT SetCertificate(DWORD dwFlags,
  22. BYTE *pbAppCert,
  23. DWORD dwCertLen,
  24. BYTE *pbAppPVK,
  25. DWORD dwPVKLen);
  26. HRESULT SACAuth(DWORD dwProtocolID,
  27. DWORD dwPass,
  28. BYTE *pbDataIn,
  29. DWORD dwDataInLen,
  30. BYTE **ppbDataOut,
  31. DWORD *pdwDataOutLen);
  32. HRESULT SACGetProtocols(DWORD **ppdwProtocols,
  33. DWORD *pdwProtocolCount);
  34. HRESULT EncryptParam(BYTE *pbData,
  35. DWORD dwDataLen);
  36. HRESULT DecryptParam(BYTE *pbData,
  37. DWORD dwDataLen);
  38. HRESULT MACInit(HMAC *phMAC);
  39. HRESULT MACUpdate(HMAC hMAC,
  40. BYTE *pbData,
  41. DWORD dwDataLen);
  42. HRESULT MACFinal(HMAC hMAC,
  43. BYTE abData[SAC_MAC_LEN]);
  44. HRESULT GetAppSec(DWORD *pdwLocalAppSec, DWORD *pdwRemoteAppSec);
  45. HRESULT SetSessionKey(BYTE *pbSPSessionKey);
  46. HRESULT GetSessionKey(BYTE *pbSPSessionKey);
  47. HRESULT GetRemoteAppCert(BYTE *pbAppCert, DWORD* pdwCertLen);
  48. BOOL fIsAuthenticated();
  49. private:
  50. BOOL m_fAuthenticated;
  51. BYTE *m_pbAppCert;
  52. DWORD m_dwCertLen;
  53. BYTE *m_pbRemoteCert;
  54. DWORD m_dwRemoteCertLen;
  55. BYTE *m_pbAppPVK;
  56. DWORD m_dwPVKLen;
  57. BYTE *m_pbSessionKey;
  58. DWORD m_dwSessionKeyLen;
  59. BYTE m_abCallerChallenge[4];
  60. BYTE m_abIssuedChallenge[4];
  61. BOOL m_TableInit;
  62. DESTable m_DesTable;
  63. #ifdef USE_X509
  64. CX509Cert m_CertObj;
  65. #endif
  66. DWORD m_dwCertFlags;
  67. MACINFO aMacInfo[20];
  68. BYTE m_abMacKey[64];
  69. BOOL m_fMacKeyInit;
  70. CRITICAL_SECTION m_CS;
  71. HRESULT Protocol1(DWORD dwPass,
  72. BYTE *pbDataIn,
  73. DWORD dwDataInLen,
  74. BYTE **ppbDataOut,
  75. DWORD *pdwDataOutLen);
  76. HRESULT Protocol2(DWORD dwPass,
  77. BYTE *pbDataIn,
  78. DWORD dwDataInLen,
  79. BYTE **ppbDataOut,
  80. DWORD *pdwDataOutLen);
  81. };
  82. #endif // _CSECURECHANNELSERVER_H_2AD99357-6FD2-11d3-8497-00C04F79DBC0