Sorry I asked this earlier in Discussion forum. But asking here again hoping to get some answer.

Sorry I asked this earlier in Discussion forum. But asking here again hoping to get some answer.

I am trying to validate a user against table aspnet_Membership that is created by asp.net MVC 5 entity framework . As most of you know it has hash password with PasswordSalt.

Any idea how to validate user against this table aspnet_Membership  from Delphi?

FYI table aspnet_Membership  has following fields
 
username, userid, password, PasswordSalt, binHash1

Thanks.

Comments

  1. create soap service via asp.net and call it. Willbe much simpler then searching for hash type

    ReplyDelete
  2. Roland Kossow Thanks Roland. Actually earlier I did found similar code from this link below and worked on it.

    Finally  I was able to get this done with help from my colleague and this link courtesy Malcolm Swaine at
    http://www.codeproject.com/Articles/32600/Manually-validating-an-ASP-NET-user-account-with-a

    Here is the final code that should do the trick.

    uses  Data.Cloud.CloudAPI,DECHash;
    ...
    ..
    function GetHash_ASPNetMemberShip(const Password, Salt:string):string;
    var
      bPassword ,bSalt ,bSaltPassword: TBytes;
    begin
       bPassword:= TEncoding.Unicode.GetBytes(Password)  ;
       bSalt:= DecodeBytes64(Salt);
       SetLength(bSaltPassword, length(bPassword)+length(bSalt));
     Move(bSalt[0],bSaltPassword[0],length(bSalt));
    Move(bPassword[0],bSaltPassword[length(bSalt)],length(bPassword));
      Result := THash_SHA1.CalcBuffer(bSaltPassword[0],  Length(bSaltPassword), TFormat_MIME64);

    end;

    ReplyDelete
  3. Arun Singh​ Cool. Thanks for sharing.

    ReplyDelete

Post a Comment