Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Password Encryption
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00640500
Message ID:
00640668
Views:
14
What is the easiest way to encrypt password? The administrators should have the ability to reset if any user forgets the password.

Neetu:

As has been pointed out, one way is using the Windows Crypto API (CAPI). VFP7 has a class in the FFC in _crypt.vcx that helps you use strong encryption in your programs:
loCrypt = NEWOBJECT("_cryptapi",HOME()+"\ffc\_crypt.vcx")
lcEncryptedString = ""
lcUserPassword = "Whatever the user wants as password"
lcKey = "Foxpro Rocks!"
loCrypt.EncryptSessionStreamString(lcUserPassword, lcKey, @lcEncryptedString)
? lcEncryptedString
You could use an option to decrypt the password or better yet, use a one-way hashing algorithm (also provided in the CAPI), that cannot really be decrypted but you can use to compare with the user's password saved in the system.

If the user forgets the password, an Admin could have a program switch that forces the user to create a new password upon nect entry, or depending on the company's security policy, a new temporary password is issued and the user has to type this new password, then he's immediately forced to create a new one.

These are just some ideas. There is of course much more that could be said to authenticate users before granting access to a system or sensitive data.

For more examples, check the samples provided with hte FFC or look at my article on the March/April 2002 issue of CoDe Magazine (http://www.code-magazine.com)


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform