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 8280923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:51:22+00:00 2026-06-08T09:51:22+00:00

An old version of an application has some passwords stored in the clear in

  • 0

An old version of an application has some passwords stored in the clear in its database. I have written an updated version that encrypts the passwords when new entries are made, but I don’t have direct access to the database to manually encrypt the entries that already exist. When the update goes live, it will try to decrypt the plaintext passwords, and crash.

Short of doing something drastic like deleting all the existing data, the only other approach I can think of is this (wrapper pseudocode called when the password data is used.):

# data refers to the password data, either encrypted or plain
if data length < AES.block_size:
    # (Shorter than initialization vector, definitely not encrypted.)
    open database and replace password entry with encrypt(data)
    login(username, data)
else:
    try: # try plaintext first
        login(username, data)
    except AuthenticationError:
        login(username, decrypt(data))
    else: #plain text worked, encrypt data for future use.
        open database and replace password entry with encrypt(data)

It seems a shame to keep this code around to solve a problem that goes away after it runs once. Is there any other approach that might work to ensure the passwords are encrypted and only decrypt the ones that need it?

  • 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-06-08T09:51:24+00:00Added an answer on June 8, 2026 at 9:51 am

    In this scenario I do one of the following, depending on the client and the system involved:

    • Set up the encrypted password code, delete all existing passwords, and make everyone enter a new password. I prefer this because the passwords were plain and over time may have been seen or shared.
    • Run a one-time script to encrypt every password in the system. This way there is never a mix.
    • Have newer encrypted passwords prefixed with the encryption method, e.g. “SHA1:”. You run the risk of someone having that same text as the start of their password, but it is unlikely.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an old (written in CakePHP 1.1!) application that has started groaning under
I have an application that doesn't use databases but it has some shared preferences
I've recently done a migration from a really old version of some application to
I have successfully upgraded an MFC application which was compiled with an old version
I have an old (around 5 years) enterprise application that I manage. Recently we
Our web application has version numbers that get served out to the client on
We have an application which stores its data in SQL Server. Each table has
We have written a pretty complex web application which has following requirements: It has
I have an SQLite database in the first version of my iPhone application (which
On github, I forked an old version of another project. I made some changes

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.