Ejemplo n.º 1
0
            // constructor for silent WinTrustDataChoice.File check
            public WinTrustData(String _fileName, WinTrustDataRevocationChecks revocationChecks)
            {
                RevocationChecks = revocationChecks;
                WinTrustFileInfo wtfiData = new WinTrustFileInfo(_fileName);

                FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WinTrustFileInfo)));
                Marshal.StructureToPtr(wtfiData, FileInfoPtr, false);
            }
Ejemplo n.º 2
0
                public WinTrustData(
                    WinTrustDataUIChoice uiChoice,
                    WinTrustDataRevocationChecks revocationCheck,
                    WinTrustDataChoice unionChoice,
                    WinTrustDataStateAction stateAction,
                    WinTrustDataProvFlags provFlags,
                    WinTrustDataUIContext uiContext,
                    WINTRUST_FILE_INFO fileInfo)
                {
                    this.UIChoice         = (uint)uiChoice;
                    this.RevocationChecks = (uint)revocationCheck;
                    this.UnionChoice      = (uint)unionChoice;
                    this.StateAction      = (uint)stateAction;
                    this.ProvFlags        = provFlags;
                    this.UIContext        = (uint)uiContext;

                    ProvFlags  |= WinTrustDataProvFlags.DisableMD2andMD4;
                    FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WINTRUST_FILE_INFO)));
                    Marshal.StructureToPtr(fileInfo, FileInfoPtr, false);
                }
Ejemplo n.º 3
0
 // constructor for silent WinTrustDataChoice.File check
 internal WinTrustData(String fileName, WinTrustDataRevocationChecks checks)
 {
     var wtfiData = new WinTrustFileInfo(fileName);
     FileInfoPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(WinTrustFileInfo)));
     Marshal.StructureToPtr(wtfiData, FileInfoPtr, false);
     RevocationChecks = checks;
 }
Ejemplo n.º 4
0
            ///
            /// Calls WinTrust.WinVerifyTrust() to check embedded file signature
            ///
            /// absolute path and file name
            /// validation to perform
            /// enumeration
            /// true if the signature is valid, otherwise false
            public static bool VerifyEmbeddedSignature(string fileName, Guid guidAction, WinTrustDataRevocationChecks revocationChecks)
            {
                WinTrustData         wtd    = new WinTrustData(fileName, revocationChecks);
                WinVerifyTrustResult result = WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd);

                return(result == WinVerifyTrustResult.Success);
            }