public static WinVerifyTrustResult VerifyEmbeddedSignature(string fileName) { using var wtfi = new WinTrustFileInfo(fileName); using var wtd = new WinTrustData(wtfi); var guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2); return(WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd)); }
public static bool VerifyEmbeddedSignature(string fileName) { using var wtfi = new WinTrustFileInfo(fileName); using var wtd = new WinTrustData(wtfi); var guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2); var result = WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd); return(result == WinVerifyTrustResult.Success || result == WinVerifyTrustResult.UntrustedRoot || result == WinVerifyTrustResult.CertChaining); }
private static extern WinVerifyTrustResult WinVerifyTrust( [In] IntPtr hwnd, [In][MarshalAs(UnmanagedType.LPStruct)] Guid pgActionID, [In] WinTrustData pWVTData );