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.

67 lines
1.9 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 1999
  5. //
  6. // File: certifct.h
  7. //
  8. // Contents:
  9. //
  10. //----------------------------------------------------------------------------
  11. #ifndef __CERTIFICT_H
  12. #define __CERTIFICT_H
  13. #include "wincrypt.h"
  14. #define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CCertificate
  17. class CCertificate
  18. {
  19. public:
  20. CCertificate(const PCCERT_CONTEXT pCertContext, HCERTSTORE hCertStore);
  21. virtual ~CCertificate();
  22. public:
  23. bool CanDelete();
  24. BOOL DeleteFromStore ();
  25. HRESULT WriteToFile (HANDLE hFile);
  26. void Refresh ();
  27. int CompareExpireDate (const CCertificate& cert) const;
  28. BOOL IsMyStore () const;
  29. PCCERT_CONTEXT GetCertContext () const;
  30. HCERTSTORE GetCertStore () const;
  31. HRESULT GetAlternateSubjectName (PWSTR* ppszAltIssuerName);
  32. HRESULT GetAlternateIssuerName (PWSTR* ppszAltIssuerName);
  33. HRESULT GetEnhancedKeyUsage (PWSTR* ppszUsages);
  34. HRESULT GetValidNotAfter (PWSTR* pszValidNotAfter);
  35. HRESULT GetSubjectName (PWSTR *ppszSubjectName);
  36. HRESULT GetIssuerName (PWSTR *ppszIssuerName);
  37. private:
  38. HRESULT FormatEnhancedKeyUsagePropertyString ();
  39. HRESULT ConvertAltNameToString (PWSTR szOID, const DWORD dwNameChoice, CString &strName);
  40. private: // data
  41. bool m_bCanDelete;
  42. DWORD m_fieldChecked;
  43. bool m_bCertContextFreed;
  44. CString m_szEnhancedKeyUsage;
  45. HCERTSTORE m_hCertStore;
  46. CString m_szAltSubjectName;
  47. CString m_szAltIssuerName;
  48. CString m_szValidNotAfter;
  49. CString m_szSubjectName;
  50. CString m_szIssuerName;
  51. PCERT_INFO m_pCertInfo;
  52. const PCCERT_CONTEXT m_pCertContext;
  53. protected:
  54. HRESULT GetNameString (DWORD dwFlag, CString &strString);
  55. HRESULT GetOIDInfo (PWSTR* string, PSTR pszObjId);
  56. HRESULT FormatDate (FILETIME utcDateTime, CString &strDateTime);
  57. };
  58. #endif