Hello,
How can I encrypt/decrypt data using AES ?
I couldn't find anything in the wiki.
Hello,
How can I encrypt/decrypt data using AES ?
I couldn't find anything in the wiki.
AFAIK, no direct api. Check the link if it is helpful.
http://qt-project.org/search/tag/cryptography
http://qt-project.org/wiki/Simple_encryption
You can also use Symbian api.
http://www.developer.nokia.com/Commu...ptography_APIs
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
Hi,
Here is one example of AES buffer encryption of files
Also, there is this thread which has discussion on similar topic
Thank you for your answers!
I am new to QT and I guess I prefer to use the Symbian native code, but I am not sure how to set the Initiliazing Vector.
Can you give me a hint on this?
Thanks again!
Check for QVector.
Use Qt-Quick to make your application UI more attractive.
http://store.ovi.com/content/271896 | http://store.ovi.com/content/276199 | http://store.ovi.com/content/276202 | http://store.ovi.com/content/280827
Hi,
Did you already check the links shared before (the symbian ones). The code in the wiki reads from file and encrypts.
Hi,
Did you see this
It would give you an idea of how it has to be defined, for processing you need to go by the algorithm/available implementations.
What I did is use openssl library that were in the symbian qt sdk (I am new to QT and please correct me if I am using some of the built-in object in a wrong way)
But now I am not able to compile on QT simulator, any ideas?
Code:#ifdef Q_OS_SYMBIAN #include <stdapis/openssl/aes.h> #include <stdapis/openssl/evp.h> #endif #ifdef MEEGO_EDITION_HARMATTAN #include <openssl/aes.h> #include <openssl/evp.h> #endif QByteArray aes_encrypt( const QByteArray aTextToEncode ) { EVP_CIPHER_CTX cipherContext; EVP_CIPHER_CTX_init( &cipherContext ); const unsigned char* key = (const unsigned char*) "enter 32 bytes key"; const unsigned char* iv = (const unsigned char*) "enter 16 bytes vector"; EVP_EncryptInit_ex( &cipherContext, EVP_aes_256_cbc(), NULL, key, iv); QByteArray encodedText; encodedText.resize( aTextToEncode.length() + AES_BLOCK_SIZE + 100 ); int c_len = 0; EVP_EncryptUpdate( &cipherContext, ( unsigned char* ) encodedText.data(), &c_len, ( unsigned char* ) aTextToEncode.constData(), aTextToEncode.length() ); qDebug("Encoded length: %d", c_len ); /* update encodedText with the final remaining bytes */ int f_len = 0; EVP_CipherFinal_ex( &cipherContext, ( unsigned char* ) encodedText.data() + c_len, &f_len ); qDebug("Encoded final length: %d", f_len ); EVP_CIPHER_CTX_cleanup( &cipherContext ); encodedText.resize( c_len + f_len ); return encodedText; } QString aesEncodeAndBase64( QString aTextToEncode ) { QByteArray encodedText = aes_encrypt( aTextToEncode.toAscii() ); QString res = encodedText.toBase64(); qDebug("Encoded string %s", qPrintable( res ) ); return res; }
Last edited by microsoft2; 2012-04-19 at 16:14.
Hi,
Did you include the library details in the symbian section of your .pro file?
Please check this section for more clarity on how to use symbian libs with QT.
Yes, working ok on symbian and harmattan device
In my .pro file I specified
The only problem is that the emulator does not have evp.h and I have to develop on deviceCode:symbian: LIBS += -llibcrypto contains(MEEGO_EDITION,harmattan): LIBS += -lcrypto