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.

158 lines
3.7 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: cainfoc.h
  7. //
  8. // Contents: Declaration of CCAInfo
  9. //
  10. // History: 16-dec-97 petesk created
  11. //
  12. //---------------------------------------------------------------------------
  13. #include "cainfop.h"
  14. #include <certca.h>
  15. /////////////////////////////////////////////////////////////////////////////
  16. // certcli
  17. class CCertTypeInfo;
  18. class CCAInfo
  19. {
  20. public:
  21. CCAInfo()
  22. {
  23. m_cRef = 1;
  24. m_pNext = NULL;
  25. m_pProperties = NULL;
  26. m_pCertificate = NULL;
  27. m_bstrDN = NULL;
  28. m_fNew = TRUE;
  29. m_dwExpiration = 1;
  30. m_dwExpUnits = CA_UNITS_YEARS;
  31. m_pSD = NULL;
  32. m_dwFlags = 0; // make sure high 16 bits are clear!
  33. }
  34. ~CCAInfo();
  35. DWORD Release();
  36. // Perform a search, returning a chain of CCAInfo objects.
  37. static HRESULT Find(
  38. LPCWSTR wszQuery,
  39. LPCWSTR wszScope,
  40. DWORD dwFlags,
  41. CCAInfo **ppCAInfo
  42. );
  43. static HRESULT FindDnsDomain(
  44. LPCWSTR wszQuery,
  45. LPCWSTR wszDNSDomain,
  46. DWORD dwFlags,
  47. CCAInfo **ppCAInfo
  48. );
  49. // Perform a search, returning a chain of CCAInfo objects.
  50. static HRESULT Create(LPCWSTR wszName, LPCWSTR wszScope, CCAInfo **ppCAInfo);
  51. static HRESULT CreateDnsDomain(LPCWSTR wszName, LPCWSTR wszDNSDomain, CCAInfo **ppCAInfo);
  52. HRESULT Update(VOID);
  53. HRESULT Delete(VOID);
  54. HRESULT Next(CCAInfo **ppCAInfo);
  55. DWORD Count()
  56. {
  57. if(m_pNext)
  58. {
  59. return m_pNext->Count()+1;
  60. }
  61. return 1;
  62. }
  63. HRESULT GetProperty(LPCWSTR wszPropertyName, LPWSTR **pawszProperties);
  64. HRESULT SetProperty(LPCWSTR wszPropertyName, LPWSTR *awszProperties);
  65. HRESULT FreeProperty(LPWSTR * awszProperties);
  66. DWORD GetFlags(VOID)
  67. {
  68. return m_dwFlags;
  69. }
  70. VOID SetFlags(DWORD dwFlags)
  71. {
  72. m_dwFlags = (m_dwFlags & ~CA_MASK_SETTABLE_FLAGS) | (dwFlags & CA_MASK_SETTABLE_FLAGS);
  73. }
  74. HRESULT GetCertificate(PCCERT_CONTEXT *ppCert);
  75. HRESULT SetCertificate(PCCERT_CONTEXT pCert);
  76. HRESULT GetExpiration(DWORD *pdwExpiration, DWORD *pdwUnits);
  77. HRESULT SetExpiration(DWORD dwExpiration, DWORD dwUnits);
  78. HRESULT EnumSupportedCertTypes(DWORD dwFlags, CCertTypeInfo **ppCertTypes);
  79. HRESULT EnumSupportedCertTypesEx(LPCWSTR wszScope, DWORD dwFlags, CCertTypeInfo **ppCertTypes);
  80. HRESULT AddCertType(CCertTypeInfo *pCertTypes);
  81. HRESULT RemoveCertType(CCertTypeInfo *pCertTypes);
  82. HRESULT SetSecurity(IN PSECURITY_DESCRIPTOR pSD);
  83. HRESULT GetSecurity(OUT PSECURITY_DESCRIPTOR * ppSD);
  84. HRESULT AccessCheck(
  85. IN HANDLE ClientToken,
  86. IN DWORD dwOption
  87. );
  88. LPCWSTR GetDN() { return m_bstrDN; }
  89. protected:
  90. PCCERT_CONTEXT m_pCertificate;
  91. static HRESULT _ProcessFind(
  92. LDAP * pld,
  93. LPCWSTR wszQuery,
  94. LPCWSTR wszScope,
  95. DWORD dwFlags,
  96. CCAInfo **ppCAInfo);
  97. HRESULT _Cleanup();
  98. DWORD AddRef();
  99. CCAProperty * m_pProperties;
  100. LONG m_cRef;
  101. CCAInfo * m_pNext;
  102. CERTSTR m_bstrDN;
  103. BOOL m_fNew;
  104. DWORD m_dwExpiration;
  105. DWORD m_dwExpUnits;
  106. DWORD m_dwFlags;
  107. PSECURITY_DESCRIPTOR m_pSD;
  108. private:
  109. };
  110. #define CA_PROP_FLAGS L"flags"