Results 1 to 20 of 20

Thread: Crypto++ and Qt

Hybrid View

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

    Default Crypto++ and Qt

    Hi guys,

    I want to use crypto++ library in a Qt application(3.3.5) developed by me.

    For this I have downloded crypto5.4 version and checked the souce files
    with some examples. I'm able to get the output.

    Now my question is here.
    I have a Qt(3.3.5) application like ms paint. It
    gererates some text file which needs to be encrypted and decrypted.

    There are so many algorithms provided in crypto++ that which one to
    use is really confusing.


    My requirement is as follows:
    I have some text files which I need to encrypt and decrypt. The
    encryption should be password protected which means whenever I encrypt
    a file a password has to be provided by the user. The other user who
    wants to read the data in that file has to first enter a correct
    password. If he/she enters correct password, the file is decrypted and
    read
    else fails.


    Now first question is
    how do I use crypto++ library in my Qt project???
    What is the procedure to include crypto++ library to my project???

    The next question is
    what algorithm is the best provided by crypto++ for the above scenario???


    Details of my project::::
    Language: C++
    GUI : Qt ( a C++ GUI Tool )
    Platform: Windows and Linux
    Editor used: On Windows-->Microsoft Visual Studio .NET 2003
    On Linux-->Kdevelop

    I have also another doubt....In the Links section there is something called
    Libraries->Qt Cryptographic Architecture. Can this help me to achieve what
    crypto++ provides...If yes please let me know how I can achieve that in my Qt
    application

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crypto++ and Qt

    Quote Originally Posted by vermarajeev View Post
    What is the procedure to include crypto++ library to my project???
    Add:
    INCLUDEPATH += <path to crypto++ includes>
    LIBS += -L<path to crypto++ lib directory> -lcrypto++
    to your .pro file.

    Quote Originally Posted by vermarajeev View Post
    what algorithm is the best provided by crypto++ for the above scenario???
    AES256 will be enough for you.

    Quote Originally Posted by vermarajeev View Post
    In the Links section there is something called
    Libraries->Qt Cryptographic Architecture. Can this help me to achieve what
    crypto++ provides...If yes please let me know how I can achieve that in my Qt
    application
    QCA integrates with Qt more easily and depending on the plugins it can support many different algorithms. Choose the library that fits you better.

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

    Default Re: Crypto++ and Qt

    Quote Originally Posted by jacek View Post
    Add: to your .pro file.
    Ok, the way what you suggested is for linux, What about Windows????? I use Microsoft Visual Studio .NET 2003 on my system. If possible with all the steps

    QCA integrates with Qt more easily and depending on the plugins it can support many different algorithms. Choose the library that fits you better.
    What is the best option either crypto++ or QCA.... You know my requirement as discussed in above thread. Please dont tell me "Choose the library that fits you better" .

    I'm totally confused about which to use either crypto++ or QCA....I feel using QCA will be easier for me as my application is developed using Qt. I just need to encrypt and decrypt some files with password protected.
    If I use external library(like crypto++) I need to care of linking it to Qt library.

    Please suggest

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crypto++ and Qt

    Quote Originally Posted by vermarajeev View Post
    Ok, the way what you suggested is for linux, What about Windows????? I use Microsoft Visual Studio .NET 2003 on my system. If possible with all the steps
    It will work on windows too, provided that you use .pro files.

    Quote Originally Posted by vermarajeev View Post
    What is the best option either crypto++ or QCA.... You know my requirement as discussed in above thread. Please dont tell me "Choose the library that fits you better" .
    But you have to choose the library, not me. Both of these libraries implement the functionality you need and both are easy to use.

    Crypto++ is a single library, while QCA needs a plugin that will implement desired algorithms, so you will have to compile at least three things to make it work and you will have to distribute more files.

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

    Default Re: Crypto++ and Qt

    Quote Originally Posted by jacek View Post
    It will work on windows too, provided that you use .pro files.


    But you have to choose the library, not me. Both of these libraries implement the functionality you need and both are easy to use.

    Crypto++ is a single library, while QCA needs a plugin that will implement desired algorithms, so you will have to compile at least three things to make it work and you will have to distribute more files.
    So, I think crypto++ is better to use than QCA since I need not distribute more files

    I have some idea about to use crypto++ with Qt. Please let me know if I'm wrong

    On windows platform
    1) In the .pro I include these statements

    INCLUDEPATH += <path to crypto++ includes>
    LIBS += -L<path to crypto++ lib directory> -lcrypto++

    Doubt1: "path to crypto++ includes" ---> I dont want to hard code the path. What is the other alternative???

    Probable Solution:According to me I'll create a directory called cryptoInclude and dump all the header files which I downloaded with crypto++. Put this folder(cryptoInclude) whereever my pro file is present, then say INCLUDEPATH += . ./cryptoInclude

    Doubt2: OH, I'm confused what to do with "path to crypto++ lib directory"
    Hmm! I think I need to put cryptopp( Exports Library file ) and cryptopp.dll ( Crypto++ Library Dll ) into a folder named cryptoLib. Put this folder whereever my pro file is present, then say

    LIBS += -L cryptoLib -lcrypto++

    2) Using the .pro file generated above create VC++ Project with this command
    qmake -project -t vcapp -o proFIlename.pro

    3) Load and execute the Qt application using Microsoft Visual Studio .NET 2003.

    DO you think when I want to use a particular class of crypto++ library, my Qt application gets compiled.

    Please bear with me if I'm talking stupid... This is my new experience
    Thanks for your unserstanding

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crypto++ and Qt

    Quote Originally Posted by vermarajeev View Post
    According to me I'll create a directory called cryptoInclude and dump all the header files which I downloaded with crypto++. Put this folder(cryptoInclude) whereever my pro file is present, then say INCLUDEPATH += . ./cryptoInclude
    It should work.

    Quote Originally Posted by vermarajeev View Post
    I think I need to put cryptopp( Exports Library file ) and cryptopp.dll ( Crypto++ Library Dll ) into a folder named cryptoLib. Put this folder whereever my pro file is present, then say

    LIBS += -L cryptoLib -lcrypto++
    Yes, that's exactly what you have to do, but with just one little correction: since the import library is called cryptopp.lib, you have to use "-lcryptopp".

    Quote Originally Posted by vermarajeev View Post
    Using the .pro file generated above create VC++ Project with this command
    qmake -project -t vcapp -o proFIlename.pro
    Yes, but if you don't use .pro files at all, you can also do it directly in VC++.

    Quote Originally Posted by vermarajeev View Post
    DO you think when I want to use a particular class of crypto++ library, my Qt application gets compiled.
    There shouldn't be any problems with it.

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

    Default Re: Crypto++ and Qt

    Quote Originally Posted by jacek View Post
    Yes, but if you don't use .pro files at all, you can also do it directly in VC++.
    How can I do this???? I'm using Microsoft Visual Studio .NET 2003 on my system.

    Also one more very improtant problem which is troubling me again and again.

    After the installation of Qt3.3.5 on windows, I should get some buttons at the top like( MOC, Open *.pro files etc) but you wont believe I dont have those butons on my editor. Now if I want to moc a file which has Q_OBJECT in it, I have to explicitly set the properties for each *.h files which is really pain...

    Is there a document which can solve my this problem?????


    I tried the process what I had explained you in above thread. And there are hundreds of warnings....I think I'm going somewhere wrong. I need to find out.

    Waiting eagerly for a reply

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crypto++ and Qt

    Quote Originally Posted by vermarajeev View Post
    How can I do this???? I'm using Microsoft Visual Studio .NET 2003 on my system.
    Sorry, I don't know, because I don't use VS.

    Quote Originally Posted by vermarajeev View Post
    After the installation of Qt3.3.5 on windows, I should get some buttons at the top like( MOC, Open *.pro files etc) but you wont believe I dont have those butons on my editor.
    Sounds like you didn't install the Qt-VS integration plugin.

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

    Default Re: Crypto++ and Qt

    Hi jacek,
    I tried the above process to include the INCLUDEPATH and LIBS as discussed above.

    First of all
    LIBS += -L<path to crypto++ lib directory> -lcryptopp
    is for Qt4 and I'm using Qt3.3.5.

    To correct above I used this
    unix:LIBS += -lcryptopp -L/. ./cryptLib/Debug

    The other important issue is
    On windows I have linked crypto++ lib successfully. It created cryptopp.lib

    then I tried the above process for linux. I get error like cryptopp is not found
    at /usr/lib/Id

    Then I realized, cryptopp.lib cannot be a library file for linux. I need to first creat a library file for linux environment then I can use above commands.

    Now my question is how can I create a library file for linux same as cryptopp.lib on windows

    Please help

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Crypto++ and Qt

    Quote Originally Posted by vermarajeev View Post
    First of all
    LIBS += -L<path to crypto++ lib directory> -lcryptopp
    is for Qt4 and I'm using Qt3.3.5.
    It works for both Qt3 and Qt4.

    Quote Originally Posted by vermarajeev View Post
    To correct above I used this
    unix:LIBS += -lcryptopp -L/. ./cryptLib/Debug
    It should be:
    unix:LIBS += -L/. ./cryptLib/Debug -lcryptopp
    Quote Originally Posted by vermarajeev View Post
    Now my question is how can I create a library file for linux same as cryptopp.lib on windows
    Use the GNUmakefile file that comes with the sources.

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

    Default Re: Crypto++ and Qt

    Quote Originally Posted by jacek View Post
    It works for both Qt3 and Qt4..
    Oh I didnt know that. Thanks for your correction

    Quote Originally Posted by jacek View Post
    Use the GNUmakefile file that comes with the sources.
    Which sources???? Where???? What is GNUmakefile????

    Please provide some document or something which can help me to solve my problem....

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.