Exemplo n.º 1
0
        private bool verifyuser(ucommit ucom)
        {
            rsakey     upbkey = ucom.getcert().getukey();
            string     mess   = ucom.getvendor() + "," + ucom.getcert().ToString() + "," + ucom.getc0().ToString() + "," + ucom.getD().ToString() + "," + ucom.getinfo();
            BigInteger messh  = hashf.hash(mess);

            return(rsa.verifySig(messh, ucom.getsigU(), upbkey));
        }
Exemplo n.º 2
0
        private bool verifyuser(ucommit ucom)
        {
            foreach (var it in clist)
            {
                if (it.getuser() == ucom.getcert().getuser())
                {
                    rsakey     upbkey = ucom.getcert().getukey();
                    string     mess   = ucom.getvendor() + "," + ucom.getcert().ToString() + "," + ucom.getc0().ToString() + "," + ucom.getD().ToString() + "," + ucom.getinfo();
                    BigInteger messh  = hashf.hash(mess);

                    return(rsa.verifySig(messh, ucom.getsigU(), upbkey));
                }
            }
            return(false);
        }
Exemplo n.º 3
0
        public void getcommit(ucommit ucom, user u)
        {
            vtb.AppendText("Commitment request received from " + u.name + "! \n");

            if (ucom.getD() < ucom.getcert().getexp())
            {
                if (verifyuser(ucom))
                {
                    if (verifycert(ucom.getcert()))
                    {
                        vtb.AppendText("\tCommitment approved, message sent ! \n");
                        trust   = true;
                        ucomm   = ucom;
                        lastpay = new payment(ucom.getc0(), 0);
                        u.comconfirm(true, this);
                        if (!(cycleth.IsAlive == true))
                        {
                            cycleth.Start();
                        }
                    }
                    else
                    {
                        vtb.AppendText("\tCertificate Signature Invalid, message sent ! \n");
                        u.comconfirm(false, this);
                    }
                }
                else
                {
                    vtb.AppendText("\tUser Signature Invalid, message sent ! \n");
                    u.comconfirm(false, this);
                }
            }
            else
            {
                vtb.AppendText("\tCertificate expired, message sent ! \n");
                u.comconfirm(false, this);
            }
        }