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 ?