views:

66

answers:

2

Curious as to how to compare a text box string to the password the user used to authenticate themselves when they started the Microsoft Access database.

Microsoft Access version is 2003. Users authenticate themselves using Microsoft Access Jet security.

UPDATE: Per CesarGon (thank you), this is really a question of comparing hashed values; how might I replicate the hashing Microsoft Access does and compare the hashes?

+1  A: 

I don't think you can do that. The passwords that users use for Jet security are hashed and stored in the System.mdw database; the passwords themselves are not stored, but only a hash computed from the password. There is no (practical) way to recover the password from that hash.

Edit. You may use the Jet API to have Jet perform the validation for you. This is some sample code:

'set security database.
DBEngine.SystemDB = "C:\Temp\System.mdw"  

'create a workspace.
Set wksp = DBEngine.CreateWorkspace("New", "John", "john's-password")

If the workspace is created, then the provided password was correct. If the password was incorrect, the workspace won't be created and an error will be raised.

CesarGon
Thanks CesarGon; how might I replicate the hashing Microsoft Access does and compare the hashes?
schultkl
@schultkl: I've no idea. I don't know what hashing algorithm Jet uses. Sorry I can't be of assistance. :-(
CesarGon
@schultkl: But maybe you can programmatically call Jet to perform the validation for you; I am editing my answer to show this.
CesarGon
Thanks! :) +1 for honesty! I appreciate your help! :D
schultkl
+1  A: 

In your change password form, you can execute an ado sql command:

ALTER USER user PASSWORD newpassword oldpassword

Just make sure the text entered for both passwords are not the same.

http://msdn.microsoft.com/en-us/library/bb177884.aspx

Jeff O
Thanks Jeff O! :) I will try this solution when I return to work on Monday.
schultkl