473,396 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Password encryption and binding

I'm adding password encryption to the Employees form. I have a
strongly-typed dataset being used as the datasource for the
EmployeesBindingSource, and the Employees table set as the datamember. All
controls on the form are bound to the EmployeesBindingSource. Except for the
password ...

I set up separate handlers for the Password and bind this control manually
when I New() the form:

Private Sub BindPasswordControl()
Dim b As Binding = New Binding("Text", EmployeesBindingSource,
"Password")
AddHandler b.Format, AddressOf PasswordFormat
AddHandler b.Parse, AddressOf PasswordParse
txtPassword.DataBindings.Add(b)
End Sub

Private Sub PasswordFormat(ByVal sender As Object, ByVal e As
ConvertEventArgs)
If IsDBNull(e.Value) = False Then
e.Value = EncryptPassword(CStr(e.Value))
End If
End Sub

The handlers ARE being called, however, the Password column of the
strongly-typed dataset does not get changed to the password entered into the
Password textbox (it remains null). I can also see that the e.Value is being
passed to the EncryptPassword function. Yet when I check the datatable, the
Password column is empty (all other columns have the correct data). What the
heck am I overlooking here!?
Feb 10 '07 #1
2 1404
Hi,

"Earl" <br******@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
I'm adding password encryption to the Employees form. I have a
strongly-typed dataset being used as the datasource for the
EmployeesBindingSource, and the Employees table set as the datamember. All
controls on the form are bound to the EmployeesBindingSource. Except for
the password ...

I set up separate handlers for the Password and bind this control manually
when I New() the form:

Private Sub BindPasswordControl()
Dim b As Binding = New Binding("Text", EmployeesBindingSource,
"Password")
AddHandler b.Format, AddressOf PasswordFormat
AddHandler b.Parse, AddressOf PasswordParse
txtPassword.DataBindings.Add(b)
End Sub

Private Sub PasswordFormat(ByVal sender As Object, ByVal e As
ConvertEventArgs)
If IsDBNull(e.Value) = False Then
e.Value = EncryptPassword(CStr(e.Value))
End If
End Sub
Where is the PasswordParse sub ?
>
The handlers ARE being called, however, the Password column of the
strongly-typed dataset does not get changed to the password entered into
the Password textbox (it remains null). I can also see that the e.Value is
being passed to the EncryptPassword function. Yet when I check the
datatable, the Password column is empty (all other columns have the
correct data). What the heck am I overlooking here!?
According to your code, EncryptPassword is called inside PasswordFormat,
Format means DataSource->Control. If you ask me you should call
EncryptPassword inside Parse and DecryptPassword inside Format....

HTH,
Greetings
>

Feb 11 '07 #2
You are correct, the Encrypt/Decrypt were backwards. Two sets of eyes are
better than one. Thanks.

"Bart Mermuys" <bm*************@hotmail.comwrote in message
news:Nf*****************@phobos.telenet-ops.be...
Hi,

"Earl" <br******@newsgroups.nospamwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>I'm adding password encryption to the Employees form. I have a
strongly-typed dataset being used as the datasource for the
EmployeesBindingSource, and the Employees table set as the datamember.
All controls on the form are bound to the EmployeesBindingSource. Except
for the password ...

I set up separate handlers for the Password and bind this control
manually when I New() the form:

Private Sub BindPasswordControl()
Dim b As Binding = New Binding("Text", EmployeesBindingSource,
"Password")
AddHandler b.Format, AddressOf PasswordFormat
AddHandler b.Parse, AddressOf PasswordParse
txtPassword.DataBindings.Add(b)
End Sub

Private Sub PasswordFormat(ByVal sender As Object, ByVal e As
ConvertEventArgs)
If IsDBNull(e.Value) = False Then
e.Value = EncryptPassword(CStr(e.Value))
End If
End Sub

Where is the PasswordParse sub ?
>>
The handlers ARE being called, however, the Password column of the
strongly-typed dataset does not get changed to the password entered into
the Password textbox (it remains null). I can also see that the e.Value
is being passed to the EncryptPassword function. Yet when I check the
datatable, the Password column is empty (all other columns have the
correct data). What the heck am I overlooking here!?

According to your code, EncryptPassword is called inside PasswordFormat,
Format means DataSource->Control. If you ask me you should call
EncryptPassword inside Parse and DecryptPassword inside Format....

HTH,
Greetings
>>


Feb 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Todd Johnson | last post by:
I am creating a dialog in wxPython for log in purposes. Basically when the user clicks the ok button, the dialog box saves the user name and password as class attributes. Then as long as the...
10
by: Max | last post by:
Hello all, I am trying to protect a page within my site with a JS password scheme. Now I know JS can be quite easily "circumvented", but I came by a code below. My question is: 1. Is there...
6
by: Ian Davies | last post by:
Hello I would like to query the user table of the mysql database from my VB application to check that a user's password entered in a text field on a form corresponds to that users password in the...
5
by: newbie | last post by:
Hello, I face a practical problem with encryption. I've read examples for encrypting a file with the DES algorythm. The algorythm uses a key and a IV value. Both are 8 bytes if I'm correct,...
4
by: PJones | last post by:
I am looking for the best way to one way encrypt a password for storage in a database using (asp.net / vb.net) basically I need some functions or examples that I can freely use in a commercial...
12
by: =?Utf-8?B?am9uaWdy?= | last post by:
I wrote a simple VB.NET application that imports and edits CSV files. Now I’d like to “lock” the raw (pre-import) CSV files so these cannot be opened separately. It is not high-sensitive...
2
by: Jeff Williams | last post by:
I am developing an application which will allow users (students) to run applications on PC's with elevated rights. This is necessary for some applications which require Administrator rights on the...
4
by: Gilles Ganault | last post by:
Hello I'd like to encrypt a customer's organization name to use this as their password to launch our application, and decrypt it within our VB5 application. We will then use this information...
0
by: Jon.Hakkinen | last post by:
Hi all, I'm on DB2 9.5 fp 0 on Windows. I have a simple SQL stored procedure which uses the Encrypt() function to insert data in a table. I do not set the encryption password inside the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.