Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an encryption app that just encrypts a string and then can decrypt also.. But how can I make it so the user sets a password and the other person has to put in that password to decrypt the message.

share|improve this question

Based on the tags in your question ( & ), I assume you intend on using the Qt framework. Thankfully, there is a library available for Qt that can do this for you. And the best part is that the library is already included in the main archives.

The library I'm referring to is called QCA - Qt Cryptographic Architecture and is available through the libqca2 Install libqca2 and libqca2-dev Install libqca2-dev packages. You will also want to install the libqca2-plugin-ossl Install libqca2-plugin-ossl package, which provides runtime support for the OpenSSL functions.

Note: before going any further, I should point out that QCA is only available for Qt 4.x at the time of writing and may not work with Qt 5.x.

Rather than going into a lot of detail on using the QCA library, I will instead point you to this example which demonstrates how to use the AES128 algorithm to securely encrypt a message with a passphrase and then decrypt it later with the same passphrase.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.