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.

103 lines
3.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-2001.
  5. //
  6. // File: certifct.h
  7. //
  8. // Contents:
  9. //
  10. //----------------------------------------------------------------------------
  11. #if !defined(AFX_CERTIFCT_H__9D512D04_126D_11D1_B5D3_00C04FB94F17__INCLUDED_)
  12. #define AFX_CERTIFCT_H__9D512D04_126D_11D1_B5D3_00C04FB94F17__INCLUDED_
  13. #if _MSC_VER >= 1000
  14. #pragma once
  15. #endif // _MSC_VER >= 1000
  16. #include "cookie.h"
  17. #include "nodetype.h"
  18. #define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CCertificate
  21. class CCertificate : public CCertMgrCookie
  22. {
  23. public:
  24. CCertificate(const PCCERT_CONTEXT pCertContext, CCertStore* pCertStore);
  25. virtual ~CCertificate();
  26. public:
  27. CString GetTemplateName();
  28. bool CanDelete();
  29. int CompareExpireDate (const CCertificate& cert) const;
  30. BOOL DeleteFromStore (bool bDoCommit);
  31. CString FormatStatus();
  32. CString GetAlternateSubjectName ();
  33. CString GetAlternateIssuerName ();
  34. PCCERT_CONTEXT GetCertContext () const;
  35. CCertStore* GetCertStore () const;
  36. CString GetDescription ();
  37. CString GetEnhancedKeyUsage ();
  38. CString GetFriendlyName ();
  39. CString GetMD5Hash ();
  40. CString GetIssuerName ();
  41. CString GetShortLastModified ();
  42. CString GetLongLastModified ();
  43. HRESULT GetLastModifiedFileTime (FILETIME& ft);
  44. PCCERT_CONTEXT GetNewCertContext ();
  45. CString GetSerialNumber ();
  46. CString GetSHAHash ();
  47. const SPECIAL_STORE_TYPE GetStoreType () const;
  48. CString GetSubjectName ();
  49. CString GetValidNotAfter ();
  50. CString GetValidNotBefore ();
  51. bool IsArchived();
  52. bool IsReadOnly ();
  53. bool IsValid ();
  54. virtual void Refresh ();
  55. HRESULT SetDescription (const CString& szDescription);
  56. HRESULT SetLastModified ();
  57. BOOL operator==(CCertificate&);
  58. void SetStore (CCertStore* pStore);
  59. private:
  60. CString DecodeV1TemplateName (PCERT_EXTENSION pCertExtension);
  61. CString DecodeV2TemplateName (PCERT_EXTENSION pCertExtension);
  62. HRESULT FormatSerialNoString(LPWSTR *ppString, CRYPT_INTEGER_BLOB const *pblob);
  63. bool FormatEnhancedKeyUsagePropertyString (CString& string);
  64. VOID DataToHex (PBYTE pSrc, CString & dest, int cb, bool bIncludeSpaces = true);
  65. HRESULT ConvertAltNameToString (LPCWSTR szOID, const DWORD dwNameChoice, CString &altName);
  66. CString CCertificate::GetLastModified(DWORD dwDateFlags, bool bRetryIfNotPresent = true);
  67. private: // data
  68. bool m_bIsArchived;
  69. bool m_bCanDelete;
  70. CCertStore* m_pCertStore;
  71. CString GetGenericHash (DWORD dwPropId);
  72. CString m_szSHAHash;
  73. CString m_szMD5Hash;
  74. CString m_szFriendlyName;
  75. CString m_szEnhancedKeyUsage;
  76. CString m_szPolicyURL;
  77. CString m_szAuthorityKeyID;
  78. CString m_szSubjectKeyID;
  79. CString m_szSerNum;
  80. CString m_szAltSubjectName;
  81. CString m_szAltIssuerName;
  82. CString m_szValidNotBefore;
  83. CString m_szValidNotAfter;
  84. CString m_szSubjectName;
  85. CString m_szIssuerName;
  86. PCERT_INFO m_pCertInfo;
  87. PCCERT_CONTEXT m_pCertContext;
  88. DWORD m_fieldChecked;
  89. CString m_szDescription;
  90. CString m_szTemplateName;
  91. };
  92. #endif // !defined(AFX_CERTIFCT_H__9D512D04_126D_11D1_B5D3_00C04FB94F17__INCLUDED_)