Exemple #1
0
        public static bool HasValidSignature(string fileName)
        {
            try {
                if (_isValidCache.Contains(fileName))
                {
                    return(true);
                }
                var wtd        = new WinTrustData(fileName);
                var guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2);
                WinVerifyTrustResult result = WinTrust.WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd);
                bool ret = (result == WinVerifyTrustResult.Success);

                if (ret)
                {
                    _isValidCache.Add(fileName);
                }
#if COAPP_ENGINE_CORE
                var response = Event <GetResponseInterface> .RaiseFirst();

                if (response != null)
                {
                    response.SignatureValidation(fileName, ret, ret ? Verifier.GetPublisherInformation(fileName)["PublisherName"] : null);
                }
#endif
                return(ret);
            } catch (Exception) {
                return(false);
            }
        }
Exemple #2
0
        public static bool HasValidSignature(string fileName)
        {
            try {
                if( _isValidCache.Contains(fileName)) {
                    return true;
                }
                var wtd = new WinTrustData(fileName);
                var guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2);
                WinVerifyTrustResult result = WinTrust.WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd);
                bool ret = (result == WinVerifyTrustResult.Success);

                if (ret) {
                    _isValidCache.Add(fileName);
                }
            #if COAPP_ENGINE_CORE
                var response = Event<GetResponseInterface>.RaiseFirst();

                if( response != null ) {
                    response.SignatureValidation(fileName, ret, ret ? Verifier.GetPublisherInformation(fileName)["PublisherName"] : null);
                }
            #endif
                return ret;
            } catch (Exception) {
                return false;
            }
        }
 public static bool HasValidSignature(string fileName)
 {
     try {
         WinTrustData wtd = new WinTrustData(fileName);
         Guid guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2);
         WinVerifyTrustResult result = WinTrust.WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd);
         bool ret = (result == WinVerifyTrustResult.Success);
         return ret;
     } catch(Exception) {
         return false;
     }
 }
Exemple #4
0
 public static bool HasValidSignature(string fileName)
 {
     try {
         if( _isValidCache.ContainsKey(fileName)) {
             return _isValidCache[fileName];
         }
         var wtd = new WinTrustData(fileName);
         var guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2);
         WinVerifyTrustResult result = WinTrust.WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd);
         bool ret = (result == WinVerifyTrustResult.Success);
         _isValidCache[fileName] = ret;
         return ret;
     } catch (Exception) {
         return false;
     }
 }