Search code examples
c++qtencryptionqtwidgets

How Do I Store Encrypted Settings in Qt/C++?


I'm working with Qt and C++ for my very first time, doing a widget-based application for the Mac. Imagine a form with settings on it (checkboxes, radio buttons, fields) and I click Update to save these settings. I want to persist that data to an encrypted file so that other applications can't hack that file. What's the recommended technique? Also, what encryption method is best for this sort of thing?


Solution

  • No encryption is necessary. You indicate that you are implementing this on a Mac, and OS-X is derived from BSD Unix, and you should have access to all the usual facilities that are provided by a UNIX/Posix based operating system.

    Just install your application using a dedicated system userid, with your application being executable only by its userid, and the application files' permissions having the world-readable bit turned off. And you will have to log in to the application's userid, using any permissible method, such as manual password entry, or ssh keys, in order to run your application.

    Your application is free to save its files without much afterthought. As long as their world-readable permissions are turned off, nothing else on the OS will be able to read it.