How do I can check a password Hash in WSE 2.0

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default How do I can check a password Hash in WSE 2.0



    By example

    Client

    token = new UsernameToken("juan", "1111", PasswordOption.TextPlain );


    Server

    protected override string AuthenticateToken( UsernameToken token )
    {
    ncadena = '1111';
    return ncadena;
    }


    This sample go well but if the password is SendHashed the sample donīt


    Client

    token = new UsernameToken("juan", "1111", PasswordOption.SendHashed );


    Server

    protected override string AuthenticateToken( UsernameToken token )
    {
    ncadena = '1111';
    return ncadena;
    }


    I donīt find example for this problem.
    Thanks,




    Juan Irigoyen Guest

  2. Similar Questions and Discussions

    1. Cannot check hashed password
      Hello, When users enter their email address and password in the login form, a login check is made using the following code. (The password is...
    2. Check HASH Password in WSE 2.0. Please Help.
      By example, the next code work well. Client token = new UsernameToken("juan", "1111", PasswordOption.TextPlain ); Server protected override...
    3. How do I check the password hash receive a token in WSE 2.0
      By example Client token = new UsernameToken("juan", "1111", PasswordOption.TextPlain ); Server protected override string...
    4. How do I can receive a token with password hash in WSE 2.0
      By example Client token = new UsernameToken("juan", "1111", PasswordOption.TextPlain ); Server protected override string...
    5. MD5 System Password check with PHP
      Hello everybody, I want to authenticate my user from web with PHP script. The user's passwords are stored in System as MD5 format (in...
  3. #2

    Default Re: How do I can check a password Hash in WSE 2.0

    You need to have the original data (in this case the password), so that you
    can perform the same hashing algorithm against the data, get the rsultant
    hash, and then compare your computed hash against the supplied one.

    Hashing is not reversible in that you cannot reverse hash it to get the
    password or original data. Bottom line, you need the original password to
    compare against OR you simply store hashes in the database against the users
    profile, so that you never actually store passwords, only ever hashes of the
    passwords that are used for comparison.

    --
    - Paul Glavich
    Microsoft MVP - ASP.NET


    "Juan Irigoyen" <juan_irigoyen@hotmail.com> wrote in message
    news:pohcac.s91.ln@orannews.oran.local...
    >
    >
    > By example
    >
    > Client
    >
    > token = new UsernameToken("juan", "1111", PasswordOption.TextPlain );
    >
    >
    > Server
    >
    > protected override string AuthenticateToken( UsernameToken token )
    > {
    > ncadena = '1111';
    > return ncadena;
    > }
    >
    >
    > This sample go well but if the password is SendHashed the sample donīt
    >
    >
    > Client
    >
    > token = new UsernameToken("juan", "1111", PasswordOption.SendHashed );
    >
    >
    > Server
    >
    > protected override string AuthenticateToken( UsernameToken token )
    > {
    > ncadena = '1111';
    > return ncadena;
    > }
    >
    >
    > I donīt find example for this problem.
    > Thanks,
    >
    >
    >
    >

    Paul Glavich [MVP - ASP.NET] Guest

  4. #3

    Default Re: How do I can check a password Hash in WSE 2.0

    Yes, but how perform the same hasing, I probe the next code, but is not
    working.

    string ncadena =
    HashPassword(Convert.ToBase64String(token.Nonce),t oken.Created,"1111");


    private string HashPassword (string nnonce, DateTime nfecha, string
    npassword)
    {

    byte[] n = System.Text.Encoding.UTF8.GetBytes(nnonce);

    byte[] c = System.Text.Encoding.UTF8.GetBytes(nfecha.ToString ());

    byte[] p = System.Text.Encoding.UTF8.GetBytes(npassword);

    byte[] toBeDiges = new byte[n.Length + c.Length + p.Length];

    Array.Copy(n,0,toBeDiges,0,n.Length);

    Array.Copy(c,0,toBeDiges,n.Length,c.Length);

    Array.Copy(p,0,toBeDiges,(n.Length + c.Length),p.Length);


    Array.Clear(p,0,p.Length);

    SHA1 hash = SHA1.Create();

    byte[] digest = hash.ComputeHash(toBeDiges);

    Array.Clear(toBeDiges,0,toBeDiges.Length);

    return Convert.ToBase64String(digest);

    }



    "Paul Glavich [MVP - ASP.NET]" <glav@aspalliance.com-NOSPAM> escribió en el
    mensaje news:ucVIX5FUEHA.1356@TK2MSFTNGP09.phx.gbl...
    >
    > You need to have the original data (in this case the password), so that
    you
    > can perform the same hashing algorithm against the data, get the rsultant
    > hash, and then compare your computed hash against the supplied one.
    >
    > Hashing is not reversible in that you cannot reverse hash it to get the
    > password or original data. Bottom line, you need the original password to
    > compare against OR you simply store hashes in the database against the
    users
    > profile, so that you never actually store passwords, only ever hashes of
    the
    > passwords that are used for comparison.
    >
    > --
    > - Paul Glavich
    > Microsoft MVP - ASP.NET
    >
    >
    > "Juan Irigoyen" <juan_irigoyen@hotmail.com> wrote in message
    > news:pohcac.s91.ln@orannews.oran.local...
    > >
    > >
    > > By example
    > >
    > > Client
    > >
    > > token = new UsernameToken("juan", "1111", PasswordOption.TextPlain );
    > >
    > >
    > > Server
    > >
    > > protected override string AuthenticateToken( UsernameToken token )
    > > {
    > > ncadena = '1111';
    > > return ncadena;
    > > }
    > >
    > >
    > > This sample go well but if the password is SendHashed the sample donīt
    > >
    > >
    > > Client
    > >
    > > token = new UsernameToken("juan", "1111", PasswordOption.SendHashed );
    > >
    > >
    > > Server
    > >
    > > protected override string AuthenticateToken( UsernameToken token )
    > > {
    > > ncadena = '1111';
    > > return ncadena;
    > > }
    > >
    > >
    > > I donīt find example for this problem.
    > > Thanks,
    > >
    > >
    > >
    > >
    >
    >
    >


    Juan Irigoyen Guest

  5. #4

    Default Re: How do I can check a password Hash in WSE 2.0

    After reading the documentation on WSE2.0, it seems you only need to return
    the actual password as part of the AuthenticateToken method that you
    override, and WSE2 will create a hash, and compare it with the one that was
    passed. The documentation is quoted below :-

    ************************************
    The SHA-1 hash of the password is sent in the SOAP message. This is the best
    way to help protect the password. When a SOAP message is received with a
    UsernameToken, WSE calls the AuthenticateToken method of the class deriving
    from UsernameTokenManager that is registered in the configuration file. The
    AuthenticateToken method returns a password or password equivalent, which
    WSE creates a SHA-1 hash from. That SHA-1 hash is compared to the one in the
    SOAP message and if they are identical, the hashed password is deemed valid.
    ************************************

    Not much help I know but here are some links that may help.

    [url]http://blogs.geekdojo.net/justin/archive/2004/06/03/2139.aspx[/url]
    [url]http://dotnetjunkies.com/WebLog/softwaremaker/[/url]
    --
    - Paul Glavich
    Microsoft MVP - ASP.NET


    "Juan Irigoyen" <juan_irigoyen@hotmail.com> wrote in message
    news:a1jjac.9d.ln@orannews.oran.local...
    > Yes, but how perform the same hasing, I probe the next code, but is not
    > working.
    >
    > string ncadena =
    > HashPassword(Convert.ToBase64String(token.Nonce),t oken.Created,"1111");
    >
    >
    > private string HashPassword (string nnonce, DateTime nfecha, string
    > npassword)
    > {
    >
    > byte[] n = System.Text.Encoding.UTF8.GetBytes(nnonce);
    >
    > byte[] c = System.Text.Encoding.UTF8.GetBytes(nfecha.ToString ());
    >
    > byte[] p = System.Text.Encoding.UTF8.GetBytes(npassword);
    >
    > byte[] toBeDiges = new byte[n.Length + c.Length + p.Length];
    >
    > Array.Copy(n,0,toBeDiges,0,n.Length);
    >
    > Array.Copy(c,0,toBeDiges,n.Length,c.Length);
    >
    > Array.Copy(p,0,toBeDiges,(n.Length + c.Length),p.Length);
    >
    >
    > Array.Clear(p,0,p.Length);
    >
    > SHA1 hash = SHA1.Create();
    >
    > byte[] digest = hash.ComputeHash(toBeDiges);
    >
    > Array.Clear(toBeDiges,0,toBeDiges.Length);
    >
    > return Convert.ToBase64String(digest);
    >
    > }
    >
    >
    >
    > "Paul Glavich [MVP - ASP.NET]" <glav@aspalliance.com-NOSPAM> escribió en
    el
    > mensaje news:ucVIX5FUEHA.1356@TK2MSFTNGP09.phx.gbl...
    > >
    > > You need to have the original data (in this case the password), so that
    > you
    > > can perform the same hashing algorithm against the data, get the
    rsultant
    > > hash, and then compare your computed hash against the supplied one.
    > >
    > > Hashing is not reversible in that you cannot reverse hash it to get the
    > > password or original data. Bottom line, you need the original password
    to
    > > compare against OR you simply store hashes in the database against the
    > users
    > > profile, so that you never actually store passwords, only ever hashes of
    > the
    > > passwords that are used for comparison.
    > >
    > > --
    > > - Paul Glavich
    > > Microsoft MVP - ASP.NET
    > >
    > >
    > > "Juan Irigoyen" <juan_irigoyen@hotmail.com> wrote in message
    > > news:pohcac.s91.ln@orannews.oran.local...
    > > >
    > > >
    > > > By example
    > > >
    > > > Client
    > > >
    > > > token = new UsernameToken("juan", "1111", PasswordOption.TextPlain );
    > > >
    > > >
    > > > Server
    > > >
    > > > protected override string AuthenticateToken( UsernameToken token )
    > > > {
    > > > ncadena = '1111';
    > > > return ncadena;
    > > > }
    > > >
    > > >
    > > > This sample go well but if the password is SendHashed the sample donīt
    > > >
    > > >
    > > > Client
    > > >
    > > > token = new UsernameToken("juan", "1111",
    asswordOption.SendHashed );
    > > >
    > > >
    > > > Server
    > > >
    > > > protected override string AuthenticateToken( UsernameToken token )
    > > > {
    > > > ncadena = '1111';
    > > > return ncadena;
    > > > }
    > > >
    > > >
    > > > I donīt find example for this problem.
    > > > Thanks,
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    > >
    >
    >
    >

    Paul Glavich [MVP - ASP.NET] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139