Results 1 to 6 of 6

Thread: Qt openssl aes lib

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Qt openssl aes lib

    Hi,

    I wrote the following enc/dec code;

    Qt Code:
    1. AES_KEY enc_key, dec_key;
    2.  
    3. AES_set_encrypt_key((unsigned char*)p_key, 128, &enc_key);
    4. AES_ecb_encrypt((unsigned char*)textManip, (unsigned char*)enc_out, &enc_key, 1);
    5.  
    6. AES_set_decrypt_key((unsigned char*)p_key, 128, &dec_key);
    7. AES_decrypt((unsigned char*)enc_out, (unsigned char*)dec_out, &dec_key);
    To copy to clipboard, switch view to plain text mode 

    & to test it;


    Qt Code:
    1. qDebug() << "Original: " << (char*)(text);
    2. enc_out[strlen(p_Text)] = '\0';
    3. qDebug() << "Encrypted: " <<(enc_out);
    4. dec_out[strlen(p_Text)] = '\0';
    5. qDebug() << "Decrypted: " << (dec_out);
    To copy to clipboard, switch view to plain text mode 

    the output is;

    Original: WirofonPC010101
    Encrypted: ??c?'r???)?A?
    Decrypted: WirofonPC010101

    which seems ecryption is working. But I somehow thought that my encrypted characters are no good. I mean Shouldn't they like

    "31298sdf788123" or "122dfsdrwer324" ??

    Thanks..

  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: Qt openssl aes lib

    You're dumping binary data as text (and it is not text) to the console.
    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. QT and OpenSSL EVP.h
    By TCB13 in forum Newbie
    Replies: 16
    Last Post: 4th September 2011, 20:04
  2. Help! Qt 4.6.0+Symbian SDK 5 does not support OPENSSL
    By coco in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 8th October 2010, 16:13
  3. problem of building qt with openssl
    By dorians58 in forum Newbie
    Replies: 1
    Last Post: 11th August 2010, 22:47
  4. Qt 4.5 Openssl problem
    By srikanth_trulyit in forum Installation and Deployment
    Replies: 1
    Last Post: 10th June 2009, 09:54
  5. Get ml.exe to build OpenSSL on VS 2005
    By captchaq in forum General Programming
    Replies: 1
    Last Post: 27th September 2008, 07:43

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.