Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having trouble validating a login password

Status
Not open for further replies.

SGLong

Programmer
Jun 6, 2000
405
0
0
US
I’m building a web based user access system based on the asp.Net Membership, Roles, and Profile system. I’m able to create new user accounts with a SQL stored procedure. Now I’m trying to validate a user login working against the stored use account details.

My aspnet_Membership table contains Password (encoded), PasswordFormat (1), and PasswordSalt (encoded) fields, along with a number of other fields. The create new account stored procedure has, in part, the following code:
Code:
SET @PasswordFormat = 1	-- 0=Plain text, 1 = Hashed, 2 = Encrypted
SET @UnencodedSalt = NEWID()

SET @PasswordSalt = dbo.base64_encode(@UnencodedSalt)

-- Encode the password
SET @EncodedPassword = dbo.base64_encode(HASHBYTES('SHA1',
	CAST(@UnencodedSalt AS varbinary(MAX))
	+ CAST(@ClearTextPassword AS varbinary(MAX))))
The unencoded salt gets encoded and saved, and this is the value in my table. Since the stored ‘salt’ value is encoded I’m not sure how to recreate the encoded password from the ‘ unencoded salt’ and the ‘clear text password’ that the user has just entered as they are logging in.

Any help would be appreciated.
Steve

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top