Check if the WeChat server signature is valid
348598
protected function checkToken()
    {
        $query = $this->query;
        $signature = $this->sign(
            $this->token,
            isset($query['timestamp']) ? $query['timestamp'] : '',
            isset($query['nonce']) ? $query['nonce'] : ''
        );
        return isset($query['signature']) && $signature === $query['signature'];
    }
357654
def check(self, request, consumer, token, signature):
        """"""
        built = self.sign(request, consumer, token)
        return built == signature
811411
@Override
    public boolean checkSign(byte[] content, byte[] data) {
        try (PooledObject<SignatureHolder> holder = CACHE.get(id).get()) {
            Signature signature = holder.get().getVerify();
            signature.update(content);
            return signature.verify(BASE_64.decrypt(data));
        } catch (Exception e) {
            throw new SecureException("加密失败", e);
        }
    }
280418
def check_x_hub_signature(signature, message):
    
    hmac_value = get_hmac(message)
    if hmac_value == signature or \
       (signature.find('=') > -1 and
            hmac_value == signature[signature.find('=') + 1:]):
        return True
    return False
211762
def valid?
      status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "INACTIVE"])
      return false unless status_validator.valid?(@status)
      country_validator = EnumAttributeValidator.new('String', ["ZZ", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"])
      return false unless country_validator.valid?(@country)
      currency_validator = EnumAttributeValidator.new('String', ["UNKNOWN_CURRENCY", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK", "DJF", "DKK", "DOP", "DZD", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYI", "UYU", "UZS", "VEF", "VND", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XTS", "XXX", "YER", "ZAR", "ZMK", "ZMW", "BTC"])
      return false unless currency_validator.valid?(@currency)
      type_validator = EnumAttributeValidator.new('String', ["PHYSICAL", "MOBILE"])
      return false unless type_validator.valid?(@type)
      return true
    end
1002421
function verify(postedMessage) {
		if (
			// Check incoming message is valid
			typeof postedMessage === 'object' &&
			typeof postedMessage.uuid === 'string' &&
			postedMessage._respondable === true
		) {
			var messageSource = _getSource();
			return (
				// Check the version matches
				postedMessage._source === messageSource ||
				// Allow free communication with axe test
				postedMessage._source === 'axeAPI.x.y.z' ||
				messageSource === 'axeAPI.x.y.z'
			);
		}
		return false;
	}
803788
def isSignatureValid(expected, received):
    
    if expected:
        if not received or expected != received:
            return False
    else:
        if received:
            return False
    return True
1079199
function verify(token, sign, options) {
  return function (done) {
    _jsonwebtoken2['default'].verifySync(token, sign, options, done);
  };
}
442869
public function verify()
    {
        $data = file_get_contents("php://input");
        $data = Xml::xmlToArr($data);
        if ($data['sign'] != Helper::signature($data, Datasheet::get('md5_key'))) {
            throw new \Exception('微信异步通信签名验证失败');
        }
        return $data;
    }
1232243
def Verify(self, message, signature, hash_algorithm=None):
    """"""
    # This method accepts both PSS and PKCS1v15 padding. PSS is preferred but
    # old clients only support PKCS1v15.

    if hash_algorithm is None:
      hash_algorithm = hashes.SHA256()

    last_e = None
    for padding_algorithm in [
        padding.PSS(
            mgf=padding.MGF1(hash_algorithm),
            salt_length=padding.PSS.MAX_LENGTH),
        padding.PKCS1v15()
    ]:
      try:
        self._value.verify(signature, message, padding_algorithm,
                           hash_algorithm)
        return True

      except exceptions.InvalidSignature as e:
        last_e = e

    raise VerificationError(last_e)
212869
public function valid(){
        $rs = $_GET['echostr'];
        if ($this->check_signature()){
            echo $rs;
            exit;
        }else{
            if ($this->business_interface) $this->business_interface->log('valid fail. get data:'.json_encode($_GET));
            echo '';
            exit;
        }
    }
294199
public static boolean checkSign(ProductPayResultInfo rst, String pubKey) {

        if (rst == null || pubKey == null) {
            return false;
        }

        Map<String, Object> paramsa = new HashMap<String, Object>();

        // 必选参数
        paramsa.put("returnCode", rst.getReturnCode());
        paramsa.put("merchantId", rst.getMerchantId());
        paramsa.put("requestId", rst.getRequestId());
        paramsa.put("productNo", rst.getProductNo());
        paramsa.put("microsAmount", rst.getMicrosAmount());
        paramsa.put("currency", rst.getCurrency());
        paramsa.put("country", rst.getCountry());
        paramsa.put("time", rst.getTime());

        // 可选参数
        paramsa.put("orderID", rst.getOrderID());
        paramsa.put("errMsg", rst.getErrMsg());

        String noSignStr = getNoSign(paramsa, false);
        return doCheck(noSignStr, rst.getSign(), pubKey);
    }
1094721
public function checkValid()
	{
		if (!$this->cookie || !$this->_token) return false;
		$send_snoopy = new Snoopy; 
		$post = array('ajax'=>1,'token'=>$this->_token);
		$submit = "https://mp.weixin.qq.com/cgi-bin/getregions?id=1017&t=ajax-getregions&lang=zh_CN";
		$send_snoopy->rawheaders['Cookie']= $this->cookie;
		$send_snoopy->submit($submit,$post);
		$result = $send_snoopy->results;
		if(json_decode($result,1)){
			return true;
		}else{
			return false;
		}
	}
218029
public static WxaUserInfo validateUserInfo(String session_key, String rawData, String signature) {
		try {
			if (DigestUtils.shaHex(rawData + session_key).equals(signature)) {
				return JsonUtil.parseObject(rawData, WxaUserInfo.class);
			}
		} catch (Exception e) {
			logger.error("", e);
		}
		return null;
	}
258021
def verifyCode(self, sessionId, code):
        

        desc = {
            "name": "SMSVerifyCodeResult",
            "desc": " VerifyCode 返回结果",
            "fields": [{
                "name": "code",
                "type": "Integer",
                "desc": "返回码，200 为正常。"
            }, {
                "name": "success",
                "type": "Boolean",
                "desc": "true 验证成功，false 验证失败。"
            }, {
                "name": "errorMessage",
                "type": "String",
                "desc": "错误信息。"
            }]
        }
        r = self.call_api(
            method=('SMS', 'POST', 'application/x-www-form-urlencoded'),
            action='/verifyCode.json',
            params={"sessionId": sessionId,
                    "code": code})
        return Response(r, desc)
802894
def check_global_valid(self):
        
        serverless_cnt = len(list(filter(lambda x: x._serverless_type, self._data['resources'])))
        if serverless_cnt > 0:
            return False
        return True
1066787
def reg_signature(client_data_json)
      payload = [
        "\x00",
        ::U2F::DIGEST.digest(app_id),
        ::U2F::DIGEST.digest(client_data_json),
        key_handle_raw,
        origin_public_key_raw
      ].join
      cert_key.sign(::U2F::DIGEST.new, payload)
    end