Example #1
0
        private void SecureBind(int coupon, ISecureBinding sb)
        {
            string mac = string.Empty;
            string contextPublicKey = string.Empty;
            string hash             = string.Empty;

            mac  = sb.InitializeBinding(coupon, Constants.PassCodeNames, Constants.PassCodeValues, ref contextPublicKey);
            hash = Utils.BinaryEncode(Utils.Hash(contextPublicKey + Passcode));
            if (mac.ToLower() != hash.ToLower())
            {
                return;
            }

            //
            // Create participant hash and finalize binding
            //
            hash = Utils.BinaryEncode(Utils.Hash(PublicKey + Passcode));
            sb.FinalizeBinding(coupon, PublicKey, hash.ToLower());
        }
Example #2
0
        public void SecureBind()
        {
            string         mac = string.Empty;
            string         contextPublicKey = string.Empty;
            string         hash             = string.Empty;
            ISecureBinding sb     = Access <ISecureBinding>();
            object         access = null;

            mac  = sb.InitializeBinding(_ParticipantCoupon, Constants.PassCodeNames, Constants.PassCodeValues, ref contextPublicKey);
            hash = Utils.BinaryEncode(Utils.Hash(contextPublicKey + Passcode));
            if (mac.ToLower() != hash.ToLower())
            {
                return;
            }

            //
            // Create participant hash and finalize binding
            //
            hash   = Utils.BinaryEncode(Utils.Hash(PublicKey + Passcode));
            access = sb.FinalizeBinding(_ParticipantCoupon, PublicKey, hash.ToLower());
            _Access.AddRange((string[])access);
        }
Example #3
0
        public void SecureBind(ref bool failedVerify)
        {
            string         mac = string.Empty;
            string         contextPublicKey = string.Empty;
            string         hash             = string.Empty;
            ISecureBinding sb     = Access <ISecureBinding>();
            object         access = null;

            failedVerify = false;
            _MainForm.Log("=> InitializeBinding({0},{1},{2}) (Context Manager)", _ParticipantCoupon, Constants.PassCodeNames, Constants.PassCodeValues);
            mac = sb.InitializeBinding(_ParticipantCoupon, Constants.PassCodeNames, Constants.PassCodeValues, ref contextPublicKey);
            _MainForm.Log("=> Verify mac. Returned Public Key: {0}", contextPublicKey);
            hash = Utils.BinaryEncode(Utils.Hash(contextPublicKey + Passcode));
            if (mac.ToLower() != hash.ToLower())
            {
                _MainForm.Log("     Failed to verify context manager");
                MainForm.UserLink = false;
                failedVerify      = true;
                return;
            }

            //
            // Create participant hash and finalize binding
            //
            hash = Utils.BinaryEncode(Utils.Hash(PublicKey + Passcode));
            _MainForm.Log("=> FinalizeBinding({0},{1},{2}) (Authentication Repository)", _ParticipantCoupon, PublicKey, hash.ToLower());
            access = sb.FinalizeBinding(_ParticipantCoupon, PublicKey, hash.ToLower());
            if (access != null)
            {
                string[] a = (string[])access;

                for (int i = 0; i < a.Length; i += 2)
                {
                    _MainForm.Log("     {0}\t{1}", a[i], a[i + 1]);
                }
            }
            _Access.AddRange((string[])access);
        }
Example #4
0
        private void SecureBind(int coupon, ISecureBinding sb)
        {
            string mac = string.Empty;
            string contextPublicKey = string.Empty;
            string hash             = string.Empty;

            _MainForm.Log("=> InitializeBinding({0},{1},{2}) (Authentication Repository)", coupon, Constants.PassCodeNames, Constants.PassCodeValues);
            mac = sb.InitializeBinding(coupon, Constants.PassCodeNames, Constants.PassCodeValues, ref contextPublicKey);
            _MainForm.Log("=> Verify mac. Returned Public Key: {0}", contextPublicKey);
            hash = Utils.BinaryEncode(Utils.Hash(contextPublicKey + Passcode));
            if (mac.ToLower() != hash.ToLower())
            {
                _MainForm.Log("     Failed to verify authentication repository.");
                return;
            }

            //
            // Create participant hash and finalize binding
            //
            hash = Utils.BinaryEncode(Utils.Hash(PublicKey + Passcode));
            _MainForm.Log("=> FinalizeBinding({0},{1},{2}) (Authentication Repository)", coupon, PublicKey, hash.ToLower());
            sb.FinalizeBinding(coupon, PublicKey, hash.ToLower());
        }