Secure edit control class. Supports storing passwords in an encrypted form in the process memory.
Пример #1
0
        public bool ContentsEqualTo(SecureEdit secOther)
        {
            Debug.Assert(secOther != null); if (secOther == null)
            {
                return(false);
            }

            byte[] pbThis  = this.ToUtf8();
            byte[] pbOther = secOther.ToUtf8();

            bool bEqual = true;

            if (pbThis.Length != pbOther.Length)
            {
                bEqual = false;
            }
            else
            {
                for (int i = 0; i < pbThis.Length; ++i)
                {
                    if (pbThis[i] != pbOther[i])
                    {
                        bEqual = false;
                        break;
                    }
                }
            }

            Array.Clear(pbThis, 0, pbThis.Length);
            Array.Clear(pbOther, 0, pbOther.Length);
            return(bEqual);
        }
Пример #2
0
 public PasswordDialog()
 {
     InitializeComponent();
       mSecureEdit = new SecureEdit();
 }
Пример #3
0
 public PasswordDialog()
 {
     InitializeComponent();
     mSecureEdit = new SecureEdit();
 }
Пример #4
0
        public bool ContentsEqualTo(SecureEdit secOther)
        {
            Debug.Assert(secOther != null); if (secOther == null) return false;

              byte[] pbThis = this.ToUtf8();
              byte[] pbOther = secOther.ToUtf8();

              bool bEqual = true;

              if (pbThis.Length != pbOther.Length) bEqual = false;
              else {
            for (int i = 0; i < pbThis.Length; ++i) {
              if (pbThis[i] != pbOther[i]) {
            bEqual = false;
            break;
              }
            }
              }

              Array.Clear(pbThis, 0, pbThis.Length);
              Array.Clear(pbOther, 0, pbOther.Length);
              return bEqual;
        }