1
0

scclient.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // Microsoft Windows Media Technologies
  3. // Copyright (c) Microsoft Corporation. All rights reserved.
  4. //
  5. #ifndef _CSECURECHANNELCLIENT_H_2AD99356_6FD2_11d3_8497_00C04F79DBC0
  6. #define _CSECURECHANNELCLIENT_H_2AD99356_6FD2_11d3_8497_00C04F79DBC0
  7. #include "wtypes.h"
  8. #ifdef USE_X509
  9. #include "rsa.h"
  10. #endif
  11. #ifdef USE_X509
  12. #include "x509cert.h"
  13. #endif
  14. #include "sac.h"
  15. class CSecureChannelClient
  16. {
  17. public:
  18. CSecureChannelClient();
  19. ~CSecureChannelClient();
  20. HRESULT SetCertificate(DWORD dwFlags,
  21. BYTE *pbAppCert,
  22. DWORD dwCertLen,
  23. BYTE *pbAppPVK,
  24. DWORD dwPVKLen);
  25. void SetInterface(IComponentAuthenticate *pComponentAuth);
  26. HRESULT Authenticate(DWORD dwProtocolID);
  27. HRESULT EncryptParam(BYTE *pbData,
  28. DWORD dwDataLen);
  29. HRESULT DecryptParam(BYTE *pbData,
  30. DWORD dwDataLen);
  31. HRESULT MACInit(HMAC *phMAC);
  32. HRESULT MACUpdate(HMAC hMAC,
  33. BYTE *pbData,
  34. DWORD dwDataLen);
  35. HRESULT MACFinal(HMAC hMAC,
  36. BYTE abData[SAC_MAC_LEN]);
  37. HRESULT GetAppSec(DWORD *pdwLocalAppSec, DWORD *pdwRemoteAppSec);
  38. HRESULT SetSessionKey(BYTE *pbSPSessionKey);
  39. HRESULT GetSessionKey(BYTE *pbSPSessionKey);
  40. HRESULT GetRemoteAppCert(BYTE *pbAppCert, DWORD* pdwCertLen);
  41. BOOL fIsAuthenticated();
  42. private:
  43. BOOL m_fAuthenticated;
  44. BYTE *m_pbAppCert;
  45. DWORD m_dwCertLen;
  46. BYTE *m_pbRemoteCert;
  47. DWORD m_dwRemoteCertLen;
  48. BYTE *m_pbAppPVK;
  49. DWORD m_dwPVKLen;
  50. BYTE *m_pbSessionKey;
  51. DWORD m_dwSessionKeyLen;
  52. BOOL m_TableInit;
  53. unsigned long m_DesTable[32];
  54. IComponentAuthenticate *m_pAuth;
  55. DWORD m_dwCertFlags;
  56. #ifdef USE_X509
  57. CX509Cert m_CertObj;
  58. #endif
  59. MACINFO aMacInfo[20];
  60. BYTE m_abMacKey[64];
  61. BOOL m_fMacKeyInit;
  62. CRITICAL_SECTION m_CS;
  63. HRESULT Protocol1();
  64. HRESULT Protocol2();
  65. };
  66. #endif // _CSECURECHANNELCLIENT_H_2AD99356-6FD2-11d3-8497-00C04F79DBC0