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.

150 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. iiscert.hxx
  5. Abstract:
  6. Definitions and data structures needed to deal with server certificates
  7. Author:
  8. Alex Mallet (amallet) 02-Dec-1997
  9. --*/
  10. #ifndef _IISCERT_HXX_
  11. #define _IISCERT_HXX_
  12. //
  13. // Enums and hash defines
  14. //
  15. //
  16. // Data structure definitions
  17. //
  18. //
  19. // Structure used to hold information to open a cert store - basically, all the parameters
  20. // you need to call CertOpenSystemStore()
  21. //
  22. typedef struct OpenCertStoreInfo
  23. {
  24. //
  25. // Parameters used in call to CryptAcquireContext() to get handle to crypt provider
  26. //
  27. LPTSTR pszContainer;
  28. LPTSTR pszProvider;
  29. DWORD dwProvType;
  30. DWORD dwFlags;
  31. LPTSTR pszStoreName;
  32. HCERTSTORE hCertStore;
  33. } OPEN_CERT_STORE_INFO, *POPEN_CERT_STORE_INFO;
  34. //
  35. // Function prototypes
  36. //
  37. OPEN_CERT_STORE_INFO* AllocateCertStoreInfo();
  38. VOID DeallocateCertStoreInfo( IN OPEN_CERT_STORE_INFO *pInfo );
  39. BOOL DuplicateCertStoreInfo( OUT OPEN_CERT_STORE_INFO **ppDestInfo,
  40. IN OPEN_CERT_STORE_INFO *pSrcInfo );
  41. //
  42. // Class used to encapsulate a server certificate
  43. //
  44. class dllexp IIS_SERVER_CERT {
  45. public:
  46. //
  47. // Constructor used when all info is already in metabase
  48. //
  49. IIS_SERVER_CERT( IN IMDCOM *pMDObject,
  50. IN LPTSTR pszMBPath );
  51. //
  52. // Destructor
  53. //
  54. ~IIS_SERVER_CERT ();
  55. //
  56. // Functions used to query state of object
  57. //
  58. DWORD Status() { return m_dwStatus ; }
  59. BOOL IsValid();
  60. BOOL IsFortezzaCert() { return m_fIsFortezzaCert; }
  61. PCCERT_CONTEXT QueryCertContext() { return m_pCertContext;}
  62. PCCERT_CONTEXT *QueryCertContextAddr() { return (&m_pCertContext); }
  63. LPTSTR QueryMBPath() { return m_strMBPath.QueryStr(); }
  64. LPTSTR QueryContainer()
  65. { return (m_pStoreInfo ? m_pStoreInfo->pszContainer : NULL); }
  66. LPTSTR QueryProviderName()
  67. { return (m_pStoreInfo ? m_pStoreInfo->pszProvider : NULL ); }
  68. DWORD QueryProviderType()
  69. { return (m_pStoreInfo ? m_pStoreInfo->dwProvType : 0); }
  70. DWORD QueryOpenFlags()
  71. { return (m_pStoreInfo ? m_pStoreInfo->dwFlags : 0 ); }
  72. LPTSTR QueryStoreName()
  73. { return (m_pStoreInfo ? m_pStoreInfo->pszStoreName : NULL) ; }
  74. HCERTSTORE QueryStoreHandle()
  75. { return (m_pStoreInfo ? m_pStoreInfo->hCertStore : NULL); }
  76. //
  77. // Handle to Fortezza CSP used to verify signatures on Fortezza certs when
  78. // building a chain.
  79. //
  80. static HCRYPTPROV m_hFortezzaCSP;
  81. static HCRYPTDEFAULTCONTEXT m_hFortezzaCtxt;
  82. private:
  83. //
  84. // Private functions
  85. //
  86. BOOL UseProgrammaticPINEntry( IN MB *pMB ) { return m_fIsFortezzaCert; }
  87. BOOL RetrievePINInfo( IN MB *pMB,
  88. OUT LPTSTR *ppszPIN,
  89. OUT LPTSTR *ppszSerialNumber,
  90. OUT LPTSTR *ppszPersonality );
  91. //
  92. // Member variables
  93. //
  94. STR m_strMBPath; //path in metabase, relative to /, where cert info is stored
  95. OPEN_CERT_STORE_INFO *m_pStoreInfo; //information about cert store of this cert
  96. HCRYPTPROV m_hCryptProv; //handle to CSP for this cert
  97. BOOL m_fIsFortezzaCert; //bool indicating whether it's a Fortezza cert
  98. PCCERT_CONTEXT m_pCertContext;
  99. DWORD m_dwStatus;
  100. };
  101. typedef IIS_SERVER_CERT *PIIS_SERVER_CERT;
  102. #endif //_IISCERT_HXX_