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.

123 lines
4.3 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998-2000 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // No portion of this source code may be reproduced
  6. // without express written permission of Microsoft Corporation.
  7. //
  8. // This source code is proprietary and confidential.
  9. //
  10. // SYSTEM: Industry Update
  11. //
  12. // CLASS: N/A
  13. // MODULE: TRUST.LIB
  14. // FILE: TRUST.H
  15. //
  16. /////////////////////////////////////////////////////////////////////
  17. //
  18. // DESC: this header file declares functions used to make cabs
  19. // signed by certain providers trusted.
  20. //
  21. // AUTHOR: Charles Ma, converted from WU CDMLIB
  22. // DATE: 10/4/2000
  23. //
  24. /////////////////////////////////////////////////////////////////////
  25. //
  26. // Revision History:
  27. //
  28. // Date Author Description
  29. // ~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  30. // 2002-01-18 KenSh Added revocation check param to VerifyFileTrust
  31. //
  32. /////////////////////////////////////////////////////////////////////
  33. //
  34. #pragma once
  35. //
  36. // define the number of bytes needed to store a SHA1 hashing value
  37. // of the public key
  38. //
  39. const UINT HASH_VAL_SIZE = 20;
  40. //
  41. // define structure used to pass in the hash values to the following
  42. // function in order to detect if one of the hash matches the
  43. // public key of the leaf cert of a file.
  44. //
  45. typedef struct _HASH_STRUCT {
  46. UINT uiCount;
  47. PBYTE pCerts;
  48. } CERT_HASH_ARRAY, *pCERT_HASH_ARRAY;
  49. /////////////////////////////////////////////////////////////////////////////
  50. //
  51. // Public Function VerifyFileTrust()
  52. //
  53. // This is a wrapper function for CheckWinTrust that both Whistler
  54. // and WU classic code should use.
  55. //
  56. // Input: szFileName - the file with complete path
  57. // pbSha1HashVae - a pointer to a 20 byte long buffer, containing
  58. // the signature SHA1 hashing value that should
  59. // be used to check this file, or NULL for checking
  60. // known Microsoft cert.
  61. // fShowBadUI - whether pop up UI in cases
  62. // (1) inproperly signed signature, or
  63. // (2) properly signed with a non-MS cert
  64. // fCheckRevocation - whether the certificat revocation list (CRL) is
  65. // checked to see whether any of the certs in the chain
  66. // have been revoked. Never prompts the user to initiate
  67. // a dial-up connection. Default = FALSE.
  68. //
  69. // Return: HRESULT - S_OK the file is signed with a valid cert
  70. // or error code.
  71. // If the file is signed correctly but cert is not
  72. // a known Microsoft cert, or it's SHA1 hash does not match
  73. // the one passed in, then CERT_UNTRUSTED_ROOT is returned.
  74. //
  75. // Good Cert: Here is the deifnition of a good cert, in addition to the fact
  76. // that the signature must be valid and not expired.
  77. // (1) The signature was signed with a cert that has
  78. // "Microsoft Root Authority" as root, or
  79. // (2) Parameter pbSha1HashVal is not NULL, and the file's SHA1
  80. // hashing value of signature matches this value, or
  81. // (3) The signature was signed with one of the following known
  82. // Microsoft cert's (they are not rooted to MS) and
  83. // pbSha1HashVal is NULL.
  84. // * Microsoft Corporation
  85. // * Microsoft Corporation MSN
  86. // * MSNBC Interactive News LLC
  87. // * Microsoft Corporation MSN (Europe)
  88. // * Microsoft Corporation (Europe)
  89. //
  90. // Note: If _WUV3TEST flag is set (for test build), then fShowBadUI is
  91. // ignored:
  92. // if reg key SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\wuv3test\WinTrustUI
  93. // is set to 1, then no UI is shown, and this function always return S_OK;
  94. // otherwise, UI always show no matter what cert, and return value is same
  95. // as the live build.
  96. //
  97. /////////////////////////////////////////////////////////////////////////////
  98. HRESULT VerifyFileTrust(
  99. IN LPCTSTR szFileName,
  100. IN pCERT_HASH_ARRAY pHashArray,
  101. BOOL fShowBadUI,
  102. BOOL fCheckRevocation = FALSE
  103. );
  104. /////////////////////////////////////////////////////////////////////////////
  105. //
  106. // Public Function ReadWUPolicyShowTrustUI()
  107. //
  108. // Input: void
  109. //
  110. // Return: BOOL - FALSE means ShowTrustUI regkey is not present, or is set to 0
  111. // TRUE means ShowTrustUI regkey is present and is set to 1
  112. //
  113. //
  114. /////////////////////////////////////////////////////////////////////////////
  115. BOOL ReadWUPolicyShowTrustUI();