Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Encryption
Qt 6.12 LTS is out! See what's new in the release blog

Encryption

Scheduled Pinned Locked Moved General and Desktop
10 Posts 6 Posters 9.2k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi there.

    The question is about string encryption and decryption? Some like QCA is too big to use. Have you ever seen anything to work AES or 3DES over OpenSSL?

    Just couple of methods like this:

    QString encrypt(const QString &data, const QString &key);
    QString decrypt(const QString &data, const QString &key);

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Darryl DSouza
      wrote on last edited by
      #2

      why not QCryptographicHash? May be hashing heps you than encrypt and decrypt.

      Darryl D'Souza

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        It is required to store encrypted password and decrypt it for server authentication.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          Darryl DSouza
          wrote on last edited by
          #4

          Ok. Then QCryptographicHash wil not hep as far as i know, since it can ony work one way...On symbian, use can use the native interfaces http://wiki.forum.nokia.com/index.ph...ptography_APIs

          Darryl D'Souza

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            Sorry, but at first your link invalid and at second we on desktop.

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              Ok, now we have something like "this":http://ompldr.org/vN2cxdg/aes.tar.bz2 for AES, but with unknown license. I remake it from "this":http://www.softwarematrix.cn/blog/misc/using-openssl-in-cpp.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                Thank you!

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  Perhaps "this code":/wiki/Simple_encryption is useful for you?

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #9

                    I use "Botan":https://github.com/randombit/botan for Encryption, please see my "blog post":http://onethingor2.blogspot.tw/search/label/Botan on how to compile botan to an library.

                    One the library is compiled, includes the lib and header. Then code would look like this.

                    @QString hash = QString("PRIVATE_KEY") + QString("PUBLIC_KEY");
                    const bool ok = Botan::check_bcrypt(hash.toStdString(), "$2a$10$.POxJepIUGgMNR/wqgdjOuEd2sz9ag5Qo84/U7lpMceXVktsaXGZ2");
                    qDebug() << "Is KEY OK ?" << ok;@

                    Or Something like this for DES Encryption

                    @SecureVector<byte> encrypt(const byte* msg, const SymmetricKey& key) {
                    Pipe pipe(get_cipher("DES/CBC", key, ENCRYPTION));
                    pipe.start_msg();
                    pipe.write(msg, strlen((const char*) msg));
                    pipe.end_msg();
                    return pipe.read_all();
                    }

                    std::string decrypt(const SecureVector<byte>& msg, const SymmetricKey& key) {
                    Pipe pipe(get_cipher("DES/CBC", key, DECRYPTION));
                    pipe.start_msg();
                    pipe.write(msg);
                    pipe.end_msg();
                    return pipe.read_all_as_string();
                    }@

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      caesarcipher_org
                      wrote last edited by
                      #10

                      An old thread, but one point that might help anyone landing here from a search: before jumping into AES or 3DES via Botan/QCryptographicHash, it is worth being clear about what problem you actually have. QCryptographicHash is a one-way hash (as noted above), so it cannot help when you need to recover the plaintext for server authentication — for that you need a reversible cipher, and you should avoid rolling your own crypto for real credentials.

                      If you just want to explore how ciphers work, I maintain a small free educational site, CaesarCipher.org, with browser-based encoders, decoders and solvers for classical ciphers (Caesar, Vigenere, Atbash, ROT13) plus a cipher identifier and Base64/hex converters. Everything runs locally in the browser, no signup. It is a teaching aid, not a replacement for a vetted library like Botan in production code — but it is handy for demonstrating substitution, frequency analysis and shift/brute-force concepts to students or when debugging your own toy implementation.

                      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
                      • Unsolved