Verifies a signature.
344426
public static function verifyWithPSS(RSAKey $key, string $message, string $signature, string $hash): bool
    {
        if (\mb_strlen($signature, '8bit') !== $key->getModulusLength()) {
            throw new \InvalidArgumentException();
        }
        $s2 = BigInteger::createFromBinaryString($signature);
        $m2 = RSAKey::exponentiate($key, $s2);
        $em = self::convertIntegerToOctetString($m2, $key->getModulusLength());
        $modBits = 8 * $key->getModulusLength();

        return self::verifyEMSAPSS($message, $em, $modBits - 1, Hash::$hash());
    }
1209817
def verify(content, signature)
      hmac = OpenSSL::HMAC.hexdigest('sha1', @secret, content)
      signature.downcase == "sha1=#{hmac}"
    end
600337
private static int checkTypeSignature(final String signature, int pos) {
        // TypeSignature:
        // Z | C | B | S | I | F | J | D | FieldTypeSignature

        switch (getChar(signature, pos)) {
        case 'Z':
        case 'C':
        case 'B':
        case 'S':
        case 'I':
        case 'F':
        case 'J':
        case 'D':
            return pos + 1;
        default:
            return checkFieldTypeSignature(signature, pos);
        }
    }
1107408
def checkvalid(s, m, pk):
    
    if len(s) != b // 4:
        raise ValueError("signature length is wrong")

    if len(pk) != b // 8:
        raise ValueError("public-key length is wrong")

    s = bytearray(s)
    m = bytearray(m)
    pk = bytearray(pk)

    R = decodepoint(s[: b // 8])
    A = decodepoint(pk)
    S = decodeint(s[b // 8 : b // 4])
    h = Hint(encodepoint(R) + pk + m)

    (x1, y1, z1, t1) = P = scalarmult_B(S)
    (x2, y2, z2, t2) = Q = edwards_add(R, scalarmult(A, h))

    if (
        not isoncurve(P)
        or not isoncurve(Q)
        or (x1 * z2 - x2 * z1) % q != 0
        or (y1 * z2 - y2 * z1) % q != 0
    ):
        raise SignatureMismatch("signature does not pass verification")
1363816
function( signature, input, key ) {

    var verifier = crypto.createVerify( this.algorithm + this.bits )

    return verifier.update( input )
      .verify( key, signature )

  }
1167825
def crypto_sign(msg, sk):
    """"""
    if len(sk) != SECRETKEYBYTES:
        raise ValueError("Bad signing key length %d" % len(sk))
    vkbytes = sk[PUBLICKEYBYTES:]
    skbytes = sk[:PUBLICKEYBYTES]
    sig = djbec.signature(msg, skbytes, vkbytes)
    return sig + msg
455040
function verifySecondSignature (transaction, publicKey) {
	var bytes = getBytes(transaction);
	var data2 = Buffer.alloc(bytes.length - 64);

	for (var i = 0; i < data2.length; i++) {
		data2[i] = bytes[i];
	}

	var hash = crypto.createHash('sha256').update(data2.toString('hex'), 'hex').digest();

	var signSignatureBuffer = Buffer.from(transaction.signSignature, 'hex');
	var publicKeyBuffer = Buffer.from(publicKey, 'hex');
	var res = naclInstance.crypto_sign_verify_detached(signSignatureBuffer, hash, publicKeyBuffer);

	return res;
}
415133
def check_signature(self):
        """"""
        if not self.signature:
            return True
        signature_value = request.headers.get(self.signature, None)
        if signature_value:
            validator = 'check_' + re.sub(r'[-]', '_', self.signature).lower()
            check_signature = getattr(signatures, validator)
            if check_signature(signature_value, request.data):
                return True
        return False
1264466
function verify (transaction) {
	var remove = 64;

	if (transaction.signSignature) {
		remove = 128;
	}

	var bytes = getBytes(transaction);
	var data2 = Buffer.alloc(bytes.length - remove);

	for (var i = 0; i < data2.length; i++) {
		data2[i] = bytes[i];
	}

	var hash = crypto.createHash('sha256').update(data2.toString('hex'), 'hex').digest();

	var signatureBuffer = Buffer.from(transaction.signature, 'hex');
	var senderPublicKeyBuffer = Buffer.from(transaction.senderPublicKey, 'hex');
	var res = naclInstance.crypto_sign_verify_detached(signatureBuffer, hash, senderPublicKeyBuffer);

	return res;
}
98667
def verify_signature(key, qs):
    """"""
    unsigned_qs = re.sub(r'&?sig=[^&]*', '', qs)
    sig = derive_signature(key, unsigned_qs)
    return urlparse.parse_qs(qs).get("sig", [None])[0] == sig
886881
def build_signature(self, user_api_key, user_secret, request):
        """"""
        path = request.get_full_path()
        sent_signature = request.META.get(
            self.header_canonical('Authorization'))
        signature_headers = self.get_headers_from_signature(sent_signature)
        unsigned = self.build_dict_to_sign(request, signature_headers)

        # Sign string and compare.
        signer = HeaderSigner(
            key_id=user_api_key, secret=user_secret,
            headers=signature_headers, algorithm=self.ALGORITHM)
        signed = signer.sign(unsigned, method=request.method, path=path)
        return signed['authorization']
706835
def derive_signature(key, qs):
    """"""
    key, qs = (key or "", qs or "")
    return hmac.new(key.encode(), qs.encode(), hashlib.sha1).hexdigest()
422015
def verify(ctx, file, account):
    
    if not file:
        print_message("Prompting for message. Terminate with CTRL-D", "info")
        file = click.get_text_stream("stdin")
    m = Message(file.read(), bitshares_instance=ctx.bitshares)
    try:
        if m.verify():
            print_message("Verified", "success")
        else:
            print_message("not verified", "error")
    except InvalidMessageSignature:
        print_message("Signature INVALID!", "error")
10634
def verify(self, sig, msg):
        '''
        
        '''
        return lib.ed25519_VerifySignature(
            sig, self.__verifyingkey, msg, len(msg)) == 1
716177
def verifySignature(self, signatureKey):
        
        try:
            parts = ByteUtil.split(self.serialized,
                                   len(self.serialized) - self.__class__.SIGNATURE_LENGTH,
                                   self.__class__.SIGNATURE_LENGTH)

            if not Curve.verifySignature(signatureKey, parts[0], parts[1]):
                raise InvalidMessageException("Invalid signature!")
        except InvalidKeyException as e:
            raise InvalidMessageException(e)
370505
def verifyCert(self, cert):
        
        tbsCert = cert.tbsCertificate
        sigAlg = tbsCert.signature
        h = hash_by_oid[sigAlg.algorithm.val]
        sigVal = raw(cert.signatureValue)
        return self.verify(raw(tbsCert), sigVal, h=h, t='pkcs')
585937
def verify_signature(self, signature):
        """"""

        devices   = [DeviceRegistration.wrap(device) for device in self.__get_u2f_devices()]
        challenge = session.pop('_u2f_challenge_')

        try:
            counter, touch = verify_authenticate(devices, challenge, signature, self.__facets_list)
        except Exception as e:
            if self.__call_fail_sign:
                self.__call_fail_sign(e)

            return {
                'status':'failed', 
                'error': 'Invalid signature!'
            }
        finally:
            pass

        if self.verify_counter(signature, counter):
            self.__call_success_sign()
            self.disable_sign()
            
            return {
                'status'  : 'ok',
                'counter' : counter,
                'message': 'Successfully verified your second factor!'
            }


        else:
            if self.__call_fail_sign:
                self.__call_fail_sign()

            return {
                'status':'failed', 
                'error': 'Device clone detected!'
            }