Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6253357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:58:41+00:00 2026-05-24T13:58:41+00:00

Due to our customer’s demands, user passwords must be kept in some readable form

  • 0

Due to our customer’s demands, user passwords must be kept in some “readable” form in order to allow accounts to be converted at a later date. Unfortunately, just saving hash values and comparing them on authentication is not an option here. Storing plain passwords in the database is not an option either of course, but using an encryption scheme like AES might be one. But in that case, the key to decrypt passwords would have to be stored on the system handling authentication and I’m not quite comfortable with that.

Hoping to get “best of both worlds”, my implementation is now using RSA asymmetric encryption to secure the passwords. Passwords are salted and encrypted using the public key. I disabled any additional, internal salting or padding mechanisms. The encrypted password will be the same every time, just like a MD5 or SHA1 hashed password would be. This way, the authentication system needs the public key, only. The private key is not required.

The private key is printed out, sealed and stored offline in the company’s safe right after it is created. But when the accounts need to be converted later, it will allow access to the passwords.

Before we deploy this solution, I’d like to hear your opinion on this scheme. Any flaws in design? Any serious drawbacks compared to the symmetric encryption? Anything else we are missing?

Thank you very much in advance!

—

Update:
In response to Jack’s arguments below, I’d like to add the relevant implementation details for our RSA-based “hashing” function:

Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
Cipher rsa = Cipher.getInstance("RSA/None/NoPadding");
rsa.init(Cipher.ENCRYPT_MODE, publicKey);
byte[] cryptRaw = rsa.doFinal(saltedPassword.getBytes());

Having quickly skimmed over the paper mentioned by Jack, I think I somewhat understand the importance of preprocessing such as OAEP. Would it be alright to extend my original question and ask if there is a way to apply the needed preprocessing and still have the function return the same output every time for each input, just as a regular hashing function would? I would accept an answer to that “bonus question” here. (Or should I make that a seperate question on SOF?)

—

Update 2:
I’m having a hard time accepting one of the present answers because I feel that none really does answer my question. But I no longer expect any more answers to come, so I’ll accept the one that I feel is most constructive.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:58:43+00:00Added an answer on May 24, 2026 at 1:58 pm

    I’m adding this as another answer because instead of answering the question asked (as I did in the first response) this is a workaround / alternative suggestion.

    Simply put:

    Use hashes BUT, whenever a user changes their password, also use your public key as follows:

    • Generate a random symmetric key and use it to encrypt the timestamp, user identifier, and new password.
      • The timestamp is to ensure you don’t mess up later when trying to find the current / most up-to-date password.
      • Username so that you know which account you’re dealing with.
      • Password because it is a requirement.
    • Store the encrypted text.
    • Encrypt the symmetric key using your public key.
    • Store the public key encrypted symmetric key with the encrypted text.
    • Destroy the in-memory plaintext symmetric key, leaving only the public key encrypted key.

    When you need to ‘convert’ the accounts using the current password, you use the private key and go through the password change records. For each one:

    • Using the private key, decrypt the symmetric key.
    • Using the symmetric key, decrypt the record.
    • If you have a record for this user already, compare timestamps, and keep the password that is most recent (discarding the older).
    • Lather, rinse, repeat.

    (Frankly I’m probably overdoing things by encrypting the timestamp and not leaving it plaintext, but I’m paranoid and I have a thing for timestamps. Don’t get me started.)

    Since you only use the public key when changing passwords, speed isn’t critical. Also, you don’t have to keep the records / files / data where the plaintext password is encrypted on the server the user uses for authentication. This data can be archived or otherwise moved off regularly, as they aren’t required for normal operations (that’s what the hash is for).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I noticed some XSS attempts on some of our sites due to some old
How to log our own error messages (for ex: error due to invalid user
Due to our clients authentication and network topology we have a number of Windows
Due to permissions on our network, the account I use to run Git Bash
Due to legacy reasons a lot of our data is stored encoded in standard
One of our applications is exhibiting poor network behavior on Vista due to the
We've just started building our own push notification system (due to client's requirement) for
Recently one of our client's websites fell prey to a SQL Injection attack due
We plan to implement our new system with Java. Due to the system's nature,
Today one of our app got rejected due to email button for enquiries and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.