Link to home
Start Free TrialLog in
Avatar of Rick Cogley
Rick CogleyFlag for Japan

asked on

Protect password data with encryption

Hello - first question on here.

I have a web database application in which I want to store passwords, but I do not like the idea of storing them in plain text. I would like to store an encrypted form of the password, and have users enter a password or key, when they need to view the password.

I can trigger a workflow in the database, which can pass stored or entered text to a URL in the form of URL parameters. For example, in a form in the application, the user sees an encrypted view of the password, and the form has a button, say [Show Password]. When [Show Password] is clicked, the app requests a key or password from the user, and passes it and the encrypted password string to an URL, where it is decrypted. The password is then shown, say in a popup.

I have a feeling that it might be more secure to use a client-side program, say javascript, which does the decrypt work.

The most basic form of this would be to have a key that is shared amongst users. That too is not very secure because of course people will share the key with someone they are not supposed to. Ultimately it would be great to use some kind of "what you have" 2-factor authentication, where the system requests a one-time-password that you enter via a Yubikey or a system like Duo-Security.

So my question is, does anyone on here have experience in these matters, to give me some general direction? Appreciate any advice, thank you in advance.

Avatar of arnold
Flag of United States of America image

Question, why would a user need to see the password they used to login?
The process you should consider is using a one way encryption, I.e. the user submits the plaintext password that is passed over a secure connection, within your app or on the database you use the encrypted password as the key to encrypt the plain text the user provided. If they encrypted and the store match, the user
'Encrypted','password' with the result being 'Encrypted'. User authenticated/authorized.
If the user forgets their password, you would use forgot password where the user will need to provide info to validate their identity and send them a link that will let them set a new password. This way you eliminate the need to maintain a key and a password since you may still run into the situation that the user forgot their password and forgot their key which gets you back to the same point of how to get the user to verify their identity and the process you would need to include to reset/create a new set of as sword/key.
Avatar of Rick Cogley


Hi & thank you Arnold - they don't; the passwords I want to protect are not the users' normal login credentials, but rather other ones they need to know to perform their daily activities. I guess a more generic idea would be to say I want to protect data in a database field, by encrypting it, and providing some means to decrypt, using something the user has.

Does the "one way encryption" you mention apply in such a case?
One way encryption usually does not lend itself to decryption.
You could use a common key access to which is control through user rights.
I.e. usera logs I and wants to see password A, a check is run to see whether usera has rights to view this password. If the user does, the process pulls the key and use it to decrypt the password. The difficulty you ay run into deals with the process of key changes.
Note that a user that can see the encrypted form and then the decrypted form, can reverse the process to derive the key.
What is the environment in which this work is, using smartcard, certificate, NTLM based authentication an option?
I see. The db and app are on a hosted SaaS solution, so it is not NTLM etc. I can trigger the passing of entered and stored data, to an URL on another server that I set up, though. So I guess that means I could have a solution that uses Yubikeys or Duo-Security's smart-phone based solution.
You could use encryption with keys based on user provided information, but you have to make sure that when a user changes those parameters, that you go through the compete decrypt/reencrypt.
Thank you for trying to help. Let me get to the basic question: Is there any technology available to encrypt a string with a master key of some kind, and be able to decrypt it using something users possess, like a Yubikey?
Avatar of arnold
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks! I can work with that idea!