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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -