To generate a 256 bit salted hash value which gets stored in the database.
The problem is that when I pull this value out of the database, it is only a 128 byte value and authentication
fails. The database field is varbinary(MAX) so why isn't it storing the full 256 bytes?
eric2820
Contributor
2777 Points
1161 Posts
Authentication issue!
Nov 22, 2012 12:14 AM|LINK
I'm using:
Rfc2898DeriveBytes rdb = newRfc2898DeriveBytes( password, Utility.ToByte( storedSalt ), 10000 );
and
byte[] passwordEnc = rdb.GetBytes( 256 );
To generate a 256 bit salted hash value which gets stored in the database.
The problem is that when I pull this value out of the database, it is only a 128 byte value and authentication fails. The database field is varbinary(MAX) so why isn't it storing the full 256 bytes?
http://www.my-msi.net/Admin
blog
If a post helps you, please mark it as Ansered, thank-you.
PashBash
Member
371 Points
81 Posts
Re: Authentication issue!
Nov 22, 2012 02:44 PM|LINK
see if declaring the passwordEnc vairable to be 256 bytes long fixes the issue
if that doesnt solve the issue, set a break point and go through each line of code one a time to make sure the byte value is actually 256 long
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Authentication issue!
Nov 23, 2012 12:44 AM|LINK
Hello,
Considering that you are saving byte collection, I think you can just use the three types instead:
1)varbinary(256)
2)image
3)bianry