Results 1 to 2 of 2

Thread: Encryption with Qt

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Default Encryption with Qt

    I want to encrypt text with Qt and I use the QCA. I followed this tutorial and successfully.

    But when I only use for decrypt, the process is failed. this is my code

    Qt Code:
    1. QCA::Cipher cipher = QCA::Cipher(QString("aes128"), QCA::Cipher::CBC,
    2. QCA::Cipher::DefaultPadding, QCA::Decode,
    3. key, iv);
    4.  
    5. QString s="0c7d98f0421591e1bec5b125170453d7";
    6. QCA::SecureArray encryptedData = s.toAscii();
    7. QCA::SecureArray decryptedData = cipher.process(encryptedData);
    8. if (!cipher.ok()) {
    9. qDebug() << "Decryption failed !";
    10. return;
    11. }
    12. qDebug() << QString(decryptedData.data());
    To copy to clipboard, switch view to plain text mode 

    What's wrong with my code?

    * Btw, I can decrypt everything what I encrypt in QCA with php-mcrypt ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Encryption with Qt

    You're decrypting textual representation (lines #5-6) of your ciphertext.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Encryption with Qt
    By safknw in forum Newbie
    Replies: 7
    Last Post: 11th July 2012, 15:06
  2. Encryption api in Qt
    By safknw in forum Qt Programming
    Replies: 2
    Last Post: 1st May 2010, 04:25
  3. need to symmetric encryption in qt app
    By FS Lover in forum Qt Programming
    Replies: 12
    Last Post: 9th March 2010, 10:38
  4. sqlite+qt+encryption
    By skrzypu in forum Qt Programming
    Replies: 4
    Last Post: 21st October 2009, 14:22
  5. Encryption and decryption
    By vermarajeev in forum General Programming
    Replies: 5
    Last Post: 27th August 2007, 21:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.