SecurePasswordTextBox - A SecureString TextBox
Glavs Blog - SecurePasswordTextBox update
"Since there has been so much interest in the SecurePasswordTextBox control (see my previous post here and here ), I thought I would take the time to iron out the bugs...
...
All is now well. Go grab it from herehttp://www.theglavs.com/DownloadItem.aspx?FileID=46
For those unaware, its a Windows Forms TextBox control that uses the .Net V2 SecureString class to store its contents. Basically, you now have a UI control that allows directly entry into this secure string class and makes it useable from a windows UI perspective. (See my previous post for a full explanation.) "
This is pretty cool. I want to play with SecureString in the context of a textbox so the timing on this is great...
(via Dan Sellers’s WebLog - Ops!!! SecurePasswordTextBox Update now Available)
Technorati Tags: SecureString, .Net 2, SecurePasswordTextBox, WinForm
2 comments:
First, I want to compliment you on doing such a great job coding this control. This is so handy!
However, I found an accessibility issue. You cannot "tab" out of the control using the keyboard. I think I found the problem. I am not sure if this breaks anything else by adding this code (I haven't tested it extensively), but I wanted to share it in case it helps somebody.
After this code in the IsInputKey method in SecureTextBox.cs...
if (allowedToDelete)
{
if (this.SelectionLength == _secureEntry.Length)
{
_secureEntry.Clear();
}
else if (this.SelectionLength > 0)
{
for (int i = 0; i < this.SelectionLength; i++)
_secureEntry.RemoveAt(this.SelectionStart);
}
else
{
if ((keyData & Keys.Delete) == Keys.Delete && this.SelectionStart < this.Text.Length)
_secureEntry.RemoveAt(this.SelectionStart);
}
}
... add the following code ...
else
{
result = base.IsInputKey(keyData);
}
I wish I could take credit for it, but Glav, http://weblogs.asp.net/user/Profile.aspx?UserID=2471, http://www.theglavs.com/ is the the control's author and deserves all the credit.
The only thing I can take credit for is digging it and re-blogging it. :)
Still thank you very much for taking the time to post this code snip. I hope, as you do, that it will help anyone else who finds this control via my post...
Plus I plan on using your snip when I work with my copy of this control too... so doubly thank you!
Again, thank you and take care,
Greg
Post a Comment