Important: Please read the Qt Code of Conduct -

Encrypt/Decrypt QImages

  • Hello,

    I am wondering if there is a straight forward way to encrypt-decrypt QImage (read from a .jpg file for example). I am aware of CryptoCpp and CryptFileDevice but as I see they only support plain files. The only solution is to save/read images as files (i.e. text files)?

    *I am not very familiar with cryptography concepts so please bear with me.

  • @tpap

    • CryptoCpp may well contain code which works on in-memory data rather than file, I don't know.

    • CryptFileDevice is open source code so you could always rip out the in-memory encryption code if you don't want a file involved.

    • Something like is a Qt class for encrypting. It works (in-memory) against any QByteArray/data, so any arbitrary bytes. You can treat a QImage as arbitrary bytes. But this does not allow you to decrypt, so probably not what you are looking for!

    • does Qt encrypt & decrypt, but does not claim to be "secure".

    Other people may be able to recommend a "standard-ish" C++ library you might want to use.

Log in to reply