here’s my problem:
- User inputs a password in the Options section of the program.
- The password is hashed (MD5) and stored in the registry.
- The program is ran, an Excel spreadsheet is created, and password protected using the hashed value that is stored in the registry.
- The user opens the spreadsheet, and is prompted to enter the password.
- The user enters the password, but it fails no matter what.
The reason it fails is because the user is inputting the password in cleartext, yet the function is comparing it to a hashed value, which it will obviously error out.
How can I hash the Excel password that is being entered when accessing the spreadsheet in order to compare it with the stored hash in the Registry?
Any ideas on working around this would also be appreciated.
I’m writing this in C# using Excel Interop…
Thanks…
Woody
Your program will have to provide the password, because the user doesn’t know what it is!
Fortunately, the
Excel.Workbooks.Openmethod takes an argument permitting you to specify the password required. So your code could get the hashed password from the registry (or from wherever you are storing it) and then open the wokrbook via code:I think this should do what you’re looking for? Let us know how it goes…
Mike