Compare password to LDAP stored password -


i creating "change password" form user required enter previous password first, new password (twice).

i should compare entered "previous password" 1 stored.

my web application uses ldap server store user credentials. password apparently stored using sha.

so previous password entered user, digest using sha1, compare it.

 string oldpass = request.getparameter("oldpass");  string enteredoldpass= app.getinstance().getcipher().cipher(oldpass);             string ldappassword= ctx.get("userpassword"); 

but isn't working, because passwords different. when store "test" in ldap obtain {sha}quqp5cyxm6yctahz05hph5gvu9m= when calling .get("userpassword"), whilst a94a8fe5ccb19ba61c4c0873d391e987982fbbd3 when hashing "test" myself.

what doing wrong here? seems step missing since result purely hex, while 1 ldap ascii. tried converting string hex (using string hex online converters) result still differnet.

you don't of this.

  • you attempt rebind user password. either succeeds or fails. tells whether right or wrong. api , protocol , server take care of hashing required.
  • or, if you're using ldap server supports extended change-password operation, provide old , new passwords in extended operation.

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -