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.

69 lines
2.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: ccert.hxx
  8. //
  9. // Contents: Microsoft Internet Security Certificate Class
  10. //
  11. // History: 15-Aug-1997 pberkman created
  12. //
  13. //--------------------------------------------------------------------------
  14. #ifndef CCERT_HXX
  15. #define CCERT_HXX
  16. #define CCERT_MAXSTORES 5
  17. class CCert_
  18. {
  19. public:
  20. CCert_(PCCERT_CONTEXT pCertContext);
  21. virtual ~CCert_(void);
  22. WCHAR *PublisherName(void);
  23. WCHAR *AgencyName(void);
  24. WCHAR *ProviderName(void);
  25. DWORD ProviderType(void);
  26. WCHAR *PrivateKeyContainer(void);
  27. PCCERT_CONTEXT CertContext(void) { return(m_pCertContext); }
  28. BOOL BuildChain(FILETIME *psftVerifyAsOf = NULL);
  29. CCert_ *IssuerCCert_(void) { return(m_pCCert_Issuer); } // build the chain first!
  30. DWORD IssuersConfidence(void) { return(m_dwConfidence); }
  31. protected:
  32. BOOL ExtractCommonNameExt(WCHAR **pwszRet);
  33. BOOL ExtractCommonNameAttr(WCHAR **pwszRet);
  34. private:
  35. HCERTSTORE m_pahStores[CCERT_MAXSTORES];
  36. DWORD m_chStores;
  37. PCCERT_CONTEXT m_pCertContext;
  38. CCert_ *m_pCCert_Issuer;
  39. WCHAR *m_pwszPublisherName;
  40. WCHAR *m_pwszAgencyName;
  41. DWORD m_dwConfidence;
  42. BOOL m_fTriedPrivateKey;
  43. WCHAR *m_pwszProvider; // if signing cert
  44. DWORD m_dwProviderType;
  45. WCHAR *m_pwszKeyContainer; // if signing cert
  46. WCHAR *GetRDNAttr(char *pszObjId, PCERT_NAME_BLOB pNameBlob);
  47. void OpenStores(void);
  48. BOOL BuildChainPrivate(DWORD chStores, HCERTSTORE *pahStores, FILETIME *psftVerifyAsOf);
  49. BOOL FindPrivateKey(void);
  50. BOOL EnumContainer(HCRYPTPROV *phProv, DWORD dwIndex, DWORD dwProvType,
  51. WCHAR *pwszProv, WCHAR **ppwszContainer);
  52. BOOL CheckContainerForKey(WCHAR *pwszProv, DWORD dwProvType, WCHAR *pwszContainer);
  53. };
  54. #endif // CCERT_HXX