Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. The best way to encrypt data.
Forum Updated to NodeBB v4.3 + New Features

The best way to encrypt data.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 399 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jenya7
    wrote on last edited by jenya7
    #1

    I have a file with a data that has to be encrypted. So I want to read the file content, to encrypt, and write to the file back. What is the right way to do it in Qt?
    For example (considering I use a xml file) Visual Studio has a special library to encrypt xml files (xml file has embedded encryption capabilities), it works real good.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Qt has no built-in library for this but there is e.g. qca or openssl

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      J 1 Reply Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        Qt has no built-in library for this but there is e.g. qca or openssl

        J Offline
        J Offline
        jenya7
        wrote on last edited by jenya7
        #3

        @Christian-Ehrlicher said in The best way to encrypt data.:

        Qt has no built-in library for this but there is e.g. qca or openssl

        I suppose it's good enough. Does it works on files or should I do read-encrypt-write? By the way - where do I store the encryption key (considering the user has an option to change it)?

        sorry, I don't quite understand

                QCA::PrivateKey seckey = QCA::KeyGenerator().createRSA(1024);
                if (seckey.isNull()) {
                    std::cout << "Failed to make private RSA key" << std::endl;
                    return 1;
                }
                QCA::PublicKey pubkey = seckey.toPublicKey();
                // check if the key can encrypt
                if (!pubkey.canEncrypt()) {
                    std::cout << "Error: this kind of key cannot encrypt" << std::endl;
                    return 1;
                }
        

        seckey is randomly generated? so is pubkey ?

        In case of an embedded application the key is stored on the chip flash - out of unauthorized reach.
        In case of OS (Linux) - I wonder how it suppose to be handled?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved