Leaked source code of windows server 2003
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.

155 lines
5.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1999
  5. //
  6. // File: enrlhelp.h
  7. //
  8. // Contents: Headers for the helper functions for smard card enrollment station
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef __ENRLHELP_H__
  12. #define __ENRLHELP_H__
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /////////////////////////////////////////////////////////////////////////////
  17. // Contants defines
  18. #define g_dwMsgAndCertEncodingType PKCS_7_ASN_ENCODING | X509_ASN_ENCODING
  19. const WCHAR g_MyStoreName[]=L"MY";
  20. /////////////////////////////////////////////////////////////////////////////
  21. // SCrdEnroll_CSP_INFO
  22. typedef struct _SCrdEnroll_CERT_SELECT_INFO
  23. {
  24. DWORD dwFlags;
  25. LPWSTR pwszCertTemplateName;
  26. }SCrdEnroll_CERT_SELECT_INFO, *PSCrdEnroll_CERT_SELECT_INFO;
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Function Prototypes
  29. LPWSTR CopyWideString(LPCWSTR wsz);
  30. BOOL SearchAndDeleteCert(PCCERT_CONTEXT pCertContext);
  31. BOOL InitlializeCSPList(DWORD *pdwCSPCount, SCrdEnroll_CSP_INFO **prgCSPInfo);
  32. void FreeCSPInfo(DWORD dwCSPCount, SCrdEnroll_CSP_INFO *prgCSPInfo);
  33. BOOL GetCAInfoFromCertType(HANDLE hToken,
  34. LPWSTR pwszCTName,
  35. DWORD *pdwValidCA,
  36. SCrdEnroll_CA_INFO **prgCAInfo);
  37. HRESULT GetCAArchivalCert(LPWSTR pwszCAName,
  38. PCCERT_CONTEXT *ppCert);
  39. BOOL InitializeCTList(DWORD *pdwCTIndex,
  40. DWORD *pdwCTCount,
  41. SCrdEnroll_CT_INFO **prgCTInfo);
  42. LPVOID SCrdEnrollAlloc (
  43. ULONG cbSize);
  44. LPVOID SCrdEnrollRealloc (
  45. LPVOID pv,
  46. ULONG cbSize);
  47. VOID SCrdEnrollFree (
  48. LPVOID pv);
  49. void FreeCTInfo(DWORD dwCTCount, SCrdEnroll_CT_INFO *rgCTInfo);
  50. void FreeCAInfo(DWORD dwCACount, SCrdEnroll_CA_INFO *rgCAInfo);
  51. HRESULT CodeToHR(HRESULT hr);
  52. HRESULT GetSelectedUserName(IDsObjectPicker *pDsObjectPicker,
  53. LPWSTR *ppwszSelectedUserSAM,
  54. LPWSTR *ppwszSelectedUserUPN);
  55. BOOL SignWithCert(LPSTR pszCSPName,
  56. DWORD dwCSPType,
  57. PCCERT_CONTEXT pSigningCert);
  58. HRESULT ChkSCardStatus(BOOL fSCardSigningCert,
  59. PCCERT_CONTEXT pSigningCertCertContext,
  60. LPSTR pszCSPNameSigningCert,
  61. DWORD dwCSPTypeSigningCert,
  62. LPSTR pszContainerSigningCert,
  63. LPWSTR pwszSelectedCSP,
  64. LPWSTR *ppwszNewContainerName);
  65. BOOL ChKInsertedCardSigningCert(LPWSTR pwszInsertProvider,
  66. DWORD dwInsertProviderType,
  67. LPWSTR pwszReaderName,
  68. PCCERT_CONTEXT pSignCertContext,
  69. LPSTR pszSignProvider,
  70. DWORD dwSignProviderType,
  71. LPSTR pszSignContainer,
  72. BOOL *pfSame);
  73. BOOL DecodeBlobW(WCHAR *pch,
  74. DWORD cch,
  75. BYTE **ppbData,
  76. DWORD *pcbData);
  77. BOOL EncodeBlobW(BYTE *pbData,
  78. DWORD cbData,
  79. DWORD dwFlags,
  80. WCHAR **ppch,
  81. DWORD *pcch);
  82. BOOL GetNameFromPKCS10(BYTE *pbPKCS10,
  83. DWORD cbPKCS10,
  84. DWORD dwFlags,
  85. LPSTR pszOID,
  86. LPWSTR *ppwszName);
  87. BOOL VerifyCertTemplateName(PCCERT_CONTEXT pCertContext,
  88. LPWSTR pwszCertTemplateName);
  89. BOOL WINAPI SelectSignCertCallBack(
  90. PCCERT_CONTEXT pCertContext,
  91. BOOL *pfInitialSelectedCert,
  92. void *pvCallbackData);
  93. BOOL VerifyCertChain(PCCERT_CONTEXT pCertContext);
  94. BOOL IsNewerCert(PCCERT_CONTEXT pFirstCert,
  95. PCCERT_CONTEXT pSecondCert);
  96. BOOL SmartCardCSP(PCCERT_CONTEXT pCertContext);
  97. DWORD GetEncodeFlag(DWORD dwFlags);
  98. BOOL GetName(LPWSTR pwszName,
  99. EXTENDED_NAME_FORMAT NameFormat,
  100. EXTENDED_NAME_FORMAT DesiredFormat,
  101. LPWSTR *ppwszDesiredName);
  102. BOOL RetrieveCAName(DWORD dwFlags,
  103. SCrdEnroll_CA_INFO *pCAInfo,
  104. LPWSTR *ppwszName);
  105. #ifdef __cplusplus
  106. } // Balance extern "C" above
  107. #endif
  108. #endif //__ENRLHELP_H__