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.

104 lines
3.4 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. bool IsCertStillInStore() const;
  28. CString GetTemplateName();
  29. bool CanDelete();
  30. int CompareExpireDate (const CCertificate& cert) const;
  31. BOOL DeleteFromStore (bool bDoCommit);
  32. CString FormatStatus();
  33. CString GetAlternateSubjectName ();
  34. CString GetAlternateIssuerName ();
  35. PCCERT_CONTEXT GetCertContext () const;
  36. CCertStore* GetCertStore () const;
  37. CString GetDescription ();
  38. CString GetEnhancedKeyUsage ();
  39. CString GetFriendlyName ();
  40. CString GetMD5Hash ();
  41. CString GetIssuerName ();
  42. CString GetShortLastModified ();
  43. CString GetLongLastModified ();
  44. HRESULT GetLastModifiedFileTime (FILETIME& ft);
  45. PCCERT_CONTEXT GetNewCertContext ();
  46. CString GetSerialNumber ();
  47. CString GetSHAHash ();
  48. const SPECIAL_STORE_TYPE GetStoreType () const;
  49. CString GetSubjectName ();
  50. CString GetValidNotAfter ();
  51. CString GetValidNotBefore ();
  52. bool IsArchived();
  53. bool IsReadOnly ();
  54. bool IsValid ();
  55. virtual void Refresh ();
  56. HRESULT SetDescription (const CString& szDescription);
  57. HRESULT SetLastModified ();
  58. BOOL operator==(CCertificate&);
  59. void SetStore (CCertStore* pStore);
  60. private:
  61. CString DecodeV1TemplateName (PCERT_EXTENSION pCertExtension);
  62. CString DecodeV2TemplateName (PCERT_INFO pCertInfo);
  63. CString OriginalDecodeV2TemplateName (PCERT_EXTENSION pCertExtension);
  64. HRESULT FormatSerialNoString(LPWSTR *ppString, CRYPT_INTEGER_BLOB const *pblob);
  65. bool FormatEnhancedKeyUsagePropertyString (CString& string);
  66. HRESULT ConvertAltNameToString (LPCWSTR szOID, const DWORD dwNameChoice, CString &altName);
  67. CString CCertificate::GetLastModified(DWORD dwDateFlags, bool bRetryIfNotPresent = true);
  68. private: // data
  69. bool m_bIsArchived;
  70. bool m_bCanDelete;
  71. CCertStore* m_pCertStore;
  72. CString GetGenericHash (DWORD dwPropId);
  73. CString m_szSHAHash;
  74. CString m_szMD5Hash;
  75. CString m_szFriendlyName;
  76. CString m_szEnhancedKeyUsage;
  77. CString m_szPolicyURL;
  78. CString m_szAuthorityKeyID;
  79. CString m_szSubjectKeyID;
  80. CString m_szSerNum;
  81. CString m_szAltSubjectName;
  82. CString m_szAltIssuerName;
  83. CString m_szValidNotBefore;
  84. CString m_szValidNotAfter;
  85. CString m_szSubjectName;
  86. CString m_szIssuerName;
  87. PCERT_INFO m_pCertInfo;
  88. PCCERT_CONTEXT m_pCertContext;
  89. DWORD m_fieldChecked;
  90. CString m_szDescription;
  91. CString m_szTemplateName;
  92. };
  93. #endif // !defined(AFX_CERTIFCT_H__9D512D04_126D_11D1_B5D3_00C04FB94F17__INCLUDED_)