Results 1 to 6 of 6

Thread: Encryption and decryption

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Encryption and decryption

    AES is AES, no matter which library implements it.

  2. #2
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Encryption and decryption

    Ok for a while I forget about perl script.

    Here is a basic question about encryption/decryption.

    I encrypt a file with AES::CBC mode using a random IV( Initialization Vector ). Now how do I get back the same IV for decrypting the encrypted file?

    If I use my defined hard coded IV I'm able to decode the file with no problem (as I know what the IV is) but I want to use a random IV to encrypt a file and then want to decrypt the encrypted file.

    The pseudo can is something like this

    Qt Code:
    1. void encryptFile( const char* password, const char* inFile, const char* outFile)
    2. {
    3. //Get random IV named iv
    4. //Digest the password named pass
    5. AES::Encryption aesEncryption(pass, CryptoPP::AES::DEFAULT_KEYLENGTH);
    6. CBC_Mode_ExternalCipher::Encryption cbcEncryption(aesEncryption, iv);
    7. //Encrypt the file
    8. }
    9.  
    10. void decryptFile( const char* password, const char* inFile, const char* outFile)
    11. {
    12. //Now to decrypt the encrypted file I need to have the same IV
    13. // with which the file was encrypted to decrypt it.
    14. //I dont know how to get it
    15.  
    16. //Get the IV from the encrypted file
    17. //digest the password
    18. //Finally decrypt the encrypted file.
    19.  
    20. }
    To copy to clipboard, switch view to plain text mode 

    In the above code I dont know how to get the same IV by which the file was encrypted. Any idea?

    If possible please give your answers taking crypto++ library in view.

    Thanks.

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

    Default Re: Encryption and decryption

    As far as I understand it, you can't. You just have to know it, like make it a part of the ciphertext

Similar Threads

  1. Basics of Encryption and decryption
    By vermarajeev in forum General Discussion
    Replies: 4
    Last Post: 26th April 2007, 11:53

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
  •  
Qt is a trademark of The Qt Company.