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.

132 lines
5.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: emailprv.cpp
  8. //
  9. // Contents: Microsoft Internet Security Authenticode Policy Provider
  10. //
  11. // Functions: EmailRegisterServer
  12. // EmailUnregisterServer
  13. // EmailCertCheckProv
  14. // EmailFinalProv
  15. //
  16. // History: 18-Sep-1997 pberkman created
  17. //
  18. //--------------------------------------------------------------------------
  19. #include "global.hxx"
  20. //////////////////////////////////////////////////////////////////////////////
  21. //
  22. // EmailRegisterServer
  23. //----------------------------------------------------------------------------
  24. // Register the Email provider
  25. //
  26. STDAPI EmailRegisterServer(void)
  27. {
  28. GUID gProv = EMAIL_ACTIONID_VERIFY;
  29. BOOL fRet;
  30. CRYPT_REGISTER_ACTIONID sRegAID;
  31. CRYPT_PROVIDER_REGDEFUSAGE sDefUsage;
  32. fRet = TRUE;
  33. //
  34. // set the usages we want
  35. //
  36. memset(&sDefUsage, 0x00, sizeof(CRYPT_PROVIDER_REGDEFUSAGE));
  37. sDefUsage.cbStruct = sizeof(CRYPT_PROVIDER_REGDEFUSAGE);
  38. sDefUsage.pgActionID = &gProv;
  39. sDefUsage.pwszDllName = SP_POLICY_PROVIDER_DLL_NAME;
  40. sDefUsage.pwszLoadCallbackDataFunctionName = "SoftpubLoadDefUsageCallData";
  41. sDefUsage.pwszFreeCallbackDataFunctionName = "SoftpubFreeDefUsageCallData";
  42. fRet &= WintrustAddDefaultForUsage(szOID_PKIX_KP_EMAIL_PROTECTION, &sDefUsage);
  43. //
  44. // set our provider
  45. //
  46. memset(&sRegAID, 0x00, sizeof(CRYPT_REGISTER_ACTIONID));
  47. sRegAID.cbStruct = sizeof(CRYPT_REGISTER_ACTIONID);
  48. // Authenticode initialization provider
  49. sRegAID.sInitProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
  50. sRegAID.sInitProvider.pwszDLLName = SP_POLICY_PROVIDER_DLL_NAME;
  51. sRegAID.sInitProvider.pwszFunctionName = SP_INIT_FUNCTION;
  52. // Authenticode object provider
  53. sRegAID.sObjectProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
  54. sRegAID.sObjectProvider.pwszDLLName = SP_POLICY_PROVIDER_DLL_NAME;
  55. sRegAID.sObjectProvider.pwszFunctionName = SP_OBJTRUST_FUNCTION;
  56. // Authenticode signature provider
  57. sRegAID.sSignatureProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
  58. sRegAID.sSignatureProvider.pwszDLLName = SP_POLICY_PROVIDER_DLL_NAME;
  59. sRegAID.sSignatureProvider.pwszFunctionName = SP_SIGTRUST_FUNCTION;
  60. // wintrust's certificate provider
  61. sRegAID.sCertificateProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
  62. sRegAID.sCertificateProvider.pwszDLLName = WT_PROVIDER_DLL_NAME; // set to wintrust.dll
  63. sRegAID.sCertificateProvider.pwszFunctionName = WT_PROVIDER_CERTTRUST_FUNCTION; // use wintrust's standard!
  64. // custom cert check due to different CTL usages
  65. sRegAID.sCertificatePolicyProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
  66. sRegAID.sCertificatePolicyProvider.pwszDLLName = SP_POLICY_PROVIDER_DLL_NAME;
  67. //TBDTBD sRegAID.sCertificatePolicyProvider.pwszFunctionName = HTTPS_CHKCERT_FUNCTION;
  68. // custom final ...
  69. sRegAID.sFinalPolicyProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
  70. sRegAID.sFinalPolicyProvider.pwszDLLName = SP_POLICY_PROVIDER_DLL_NAME;
  71. //TBDTBD sRegAID.sFinalPolicyProvider.pwszFunctionName = HTTPS_FINALPOLICY_FUNCTION;
  72. // Authenticode cleanup -- we don't store any data.
  73. sRegAID.sCleanupProvider.cbStruct = sizeof(CRYPT_TRUST_REG_ENTRY);
  74. sRegAID.sCleanupProvider.pwszDLLName = SP_POLICY_PROVIDER_DLL_NAME;
  75. sRegAID.sCleanupProvider.pwszFunctionName = SP_CLEANUPPOLICY_FUNCTION;
  76. fRet &= WintrustAddActionID(&gProv, 0, &sRegAID);
  77. return((fRet) ? S_OK : S_FALSE);
  78. }
  79. //////////////////////////////////////////////////////////////////////////////
  80. //
  81. // DllUnregisterServer
  82. //----------------------------------------------------------------------------
  83. // unregisters email provider
  84. //
  85. STDAPI HTTPSUnregisterServer(void)
  86. {
  87. GUID gProv = EMAIL_ACTIONID_VERIFY;
  88. WintrustRemoveActionID(&gProv);
  89. return(S_OK);
  90. }
  91. //////////////////////////////////////////////////////////////////////////////
  92. //
  93. // Exported functions for wintrust
  94. //
  95. BOOL WINAPI EmailCheckCertProv(CRYPT_PROVIDER_DATA *pProvData, DWORD idxSigner,
  96. BOOL fCounterSignerChain, DWORD idxCounterSigner)
  97. {
  98. }
  99. HRESULT WINAPI HTTPSFinalProv(CRYPT_PROVIDER_DATA *pProvData)
  100. {
  101. }
  102. ///////////////////////////////////////////////////////////////////////////////////
  103. //
  104. // Local Functions
  105. //
  106. ///////////////////////////////////////////////////////////////////////////////////