Verifies a zero-knowledge proof where p \in G1.
    @errorOnFail: Raise an exception if the proof does not hold.
559782
def verify(x, t, y, pi, errorOnFail=True):
    
    # Unpack the proof
    p,c,u = pi

    # Verify types
    assertType(x, G1Element)
    assertType(y, GtElement)
    assertType(p, G1Element)
    assertScalarType(c)
    assertScalarType(u)

    # TODO: beta can be pre-computed while waiting for a server response.
    Q = generatorG1()
    beta = pair(x,hashG2(t))

    # Recompute c'
    t1 = Q*u + p*c 
    t2 = beta**u * y**c

    t1.normalize()

    cPrime = hashZ(Q,p,beta,y,t1,t2)

    # Check computed @c' against server's value @c
    if cPrime == c:
        return True

    if errorOnFail:
        raise Exception("zero-knowledge proof failed verification.")
    else:
        return False
643589
public void verify() throws GlobusCredentialException {
        try {
            String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations();
            String crlPattern = caCertsLocation + "/*.r*";
            String sigPolPattern = caCertsLocation + "/*.signing_policy";
            KeyStore keyStore = KeyStore.getInstance(GlobusProvider.KEYSTORE_TYPE, GlobusProvider.PROVIDER_NAME);
            CertStore crlStore = CertStore.getInstance(GlobusProvider.CERTSTORE_TYPE, new ResourceCertStoreParameters(null,crlPattern));
            ResourceSigningPolicyStore sigPolStore = new ResourceSigningPolicyStore(new ResourceSigningPolicyStoreParameters(sigPolPattern));
            keyStore.load(KeyStoreParametersFactory.createTrustStoreParameters(caCertsLocation));
            X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false);
            X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator();
            validator.engineValidate(CertificateUtil.getCertPath(this.cred.getCertificateChain()), parameters);
        } catch (Exception e) {
        	e.printStackTrace();
            throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e);
        }
    }
104978
public static void verify(X509Certificate cert, PublicKey key,
            Provider sigProvider) throws CertificateException,
            NoSuchAlgorithmException, InvalidKeyException, SignatureException {
        cert.verify(key, sigProvider);
    }
227405
public static void verifyCondition(@Nullable ErrorCollector errorCollector, @Nullable ValueRecorder recorder,
      @Nullable String text, int line, int column, @Nullable Object message, @Nullable Object condition) {
    if (!GroovyRuntimeUtil.isTruthy(condition)) {
      final ConditionNotSatisfiedError conditionNotSatisfiedError = new ConditionNotSatisfiedError(
        new Condition(getValues(recorder), text, TextPosition.create(line, column), messageToString(message), null, null));
      errorCollector.collectOrThrow(conditionNotSatisfiedError);
    }
  }
81248
public void assertAuthFail(byte[] expectedSignature, BuilderMode builderMode, String errorMessage) {
        if (isHashEquals(expectedSignature, builderMode)) {
            if (Validator.isEmpty(errorMessage)) {
                throw new IllegalArgumentException();
            } else {
                throw new IllegalArgumentException(errorMessage);
            }
        }
    }
382314
def gpg_error(exception, message):
    """"""
    LOGGER.debug("GPG Command %s", ' '.join([str(x) for x in exception.cmd]))
    LOGGER.debug("GPG Output %s", exception.output)
    raise CryptoritoError(message)
1032211
def verify(expr, params=None):
    
    try:
        compile(expr, params=params)
        return True
    except com.TranslationError:
        return False
107618
def get_proof(self):
        

        if self.maplesat and self.prfile:
            self.prfile.seek(0)
            return [line.rstrip() for line in self.prfile.readlines()]
187307
def inverse(x, p, errorOnFail=False):
    
    # Check types
    assertType(x, BigInt)

    # There are a number of ways in RELIC to compute this inverse, but
    # for simplicity, we'll use the extended GCD algorithm because it 
    # involves less type conversions. On the initial development platform
    # Lehmer's algorithm was the most performant: we call it directly.
    gcd = BigInt()
    inv = BigInt()

    # bn_gcd_ext(c, d, e, a, b) computes: c = a*d + b*e
    # We take x=a. b=p, and expect: c = 1 = gcd(x,p), d = 1/x, and e is unused.
    librelic.bn_gcd_ext_lehme(byref(gcd), byref(inv), None, byref(x), byref(p))

    # Check that GCD == 1 
    if gcd != 1:
        if errorOnFail:
            raise Exception("Cannot find an inverse. gcd(x,p) == {}, but we need gcd(x,p) == 1 to find an inverse.".
                format(long(gcd)))
        else:
            return None

    return inv
351114
public static boolean verify(byte[] text, byte[] signatureValue, PublicKey key, String algorithm)
        throws SignatureException {
        Signature signature;
        try {
            signature = Signature.getInstance(algorithm);
            signature.initVerify(key);
        } catch (GeneralSecurityException e) {
            throw new IllegalArgumentException("cannot initialize signature for algorithm " + algorithm, e);
        }
        signature.update(text);
        return signature.verify(signatureValue);
    }
267495
def _assert_no_error(error, exception_class=None):
    
    if error == 0:
        return

    cf_error_string = Security.SecCopyErrorMessageString(error, None)
    output = _cf_string_to_unicode(cf_error_string)
    CoreFoundation.CFRelease(cf_error_string)

    if output is None or output == u'':
        output = u'OSStatus %s' % error

    if exception_class is None:
        exception_class = ssl.SSLError

    raise exception_class(output)
1127936
def validate_proof(proof, target_hash, merkle_root, hash_f=sha256):
    

    if not proof:
        # no siblings, single item tree, so the hash should also be the root
        return target_hash == merkle_root

    target_hash = get_buffer(target_hash)
    merkle_root = get_buffer(merkle_root)

    proof_hash = target_hash
    for x in proof:
        if 'left' in x:
            # then the sibling is a left node
            proof_hash = get_buffer(hash_f(get_buffer(x['left']) + proof_hash))
        elif 'right' in x:
            # then the sibling is a right node
            proof_hash = get_buffer(hash_f(proof_hash + get_buffer(x['right'])))
        else:
            # no left or right designation exists, proof is invalid
            return False

    return hexlify(proof_hash) == hexlify(merkle_root)
219369
def verify_true(self, expr, msg=None):
        
        try:
            self.assert_true(expr, msg)
        except AssertionError, e:
            if msg:
                m = "%s:\n%s" % (msg, str(e))
            else:
                m = str(e)
            self.verification_erorrs.append(m)
196878
private static String[] verifyImplicitOption(String[] args)
        throws ProblemException {

        boolean foundImplicit = false;
        for (String a : args) {
            if (a.startsWith("-implicit:")) {
                foundImplicit = true;
                if (!a.equals("-implicit:none")) {
                    throw new ProblemException("The only allowed setting for sjavac is -implicit:none, it is also the default.");
                }
            }
        }
        if (foundImplicit) {
            return args;
        }
        // -implicit:none not found lets add it.
        String[] newargs = new String[args.length+1];
        System.arraycopy(args,0, newargs, 0, args.length);
        newargs[args.length] = "-implicit:none";
        return newargs;
    }
511608
public void verify() throws Exception {

        Map<String, ProxyPolicyHandler> handlers = null;
        if (proxyCertInfo != null) {
            String oid = proxyCertInfo.getProxyPolicy().getPolicyLanguage().getId();
            handlers = new HashMap<String,ProxyPolicyHandler>();
            handlers.put(oid, new ProxyPolicyHandler() {
                public void validate(ProxyCertInfo proxyCertInfo,
                         CertPath certPath,
                         int index)
                throws CertPathValidatorException {
                // ignore policy - this is just for proxy init case
                System.out.println("Proxy verify: Ignoring proxy policy");
                if (debug) {
                    String policy =
                    new String(proxyCertInfo.getProxyPolicy().getPolicy());
                    System.out.println("Policy:");
                    System.out.println(policy);
                }
              }
            });
        }

        KeyStore keyStore = Stores.getDefaultTrustStore();
        CertStore crlStore = Stores.getDefaultCRLStore();
        ResourceSigningPolicyStore sigPolStore = Stores.getDefaultSigningPolicyStore();
        X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false, handlers);
        X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator();
        validator.engineValidate(CertificateUtil.getCertPath(proxy.getCertificateChain()), parameters);
    }
421387
protected boolean verifyCondition1(IContextMapping<INode> mapping, IMappingElement<INode> e) {
        return findRelation(IMappingElement.LESS_GENERAL, e.getSource().getAncestors(), e.getTarget(), mapping) ||
                findRelation(IMappingElement.EQUIVALENCE, e.getSource().getAncestors(), e.getTarget(), mapping) ||

                findRelation(IMappingElement.LESS_GENERAL, e.getSource(), e.getTarget().getDescendants(), mapping) ||
                findRelation(IMappingElement.EQUIVALENCE, e.getSource(), e.getTarget().getDescendants(), mapping) ||

                findRelation(IMappingElement.LESS_GENERAL, e.getSource().getAncestors(), e.getTarget().getDescendants(), mapping) ||
                findRelation(IMappingElement.EQUIVALENCE, e.getSource().getAncestors(), e.getTarget().getDescendants(), mapping);
    }
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)