Results 1 to 17 of 17

Thread: Qssl

  1. #1
    Join Date
    Feb 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Post Qssl

    hi,
    i have to download files from server. for that i am trying with qt exaples (../examples../ http) code. but i am unable to download. i came to knew that i have to configure SSL. i have searched for examples in internet, but ididn't found. can anyone help me how to solve my problem so that i'll be thankful to you.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qssl

    did you build Qt with OpenSSL?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Feb 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Post Re: Qssl

    thanks for u r quick reply. i am using qt buitin example code for downloading files from server. it is downloading from some servers but for some urls it is showing message as unknown protocol. i knew that server has SSL and also authentication required. now i think problem is clear for u.

  4. #4
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qssl

    I suppose that you have build Qt by your own from source. So when doing this you have to clearly configure built for OpenSSL if you want to use QSsl* classes. Examples are also built on your system with your own Qt, so if you dont have SSL in your Qt build then SSL is not available in examples. And this is probably your case. So, as spirit said:
    did you build Qt with OpenSSL?
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qssl

    yup, exactly.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  6. #6
    Join Date
    Feb 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Post Re: Qssl

    first of all, i don't know whether this is the solution for my problem or not. my problem is i am not able to download files from appache server which has SSL communicatio and i am able to downlaod files from some other servers. that's why i am asking Qssl may be prevent my problem. is it correct approach?

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qssl

    if server uses ssl connection then you have to use QSsl* classes and for using them you have to build Qt with OpenSSL.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  8. #8
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qssl

    Here is a part of httpwindow.cpp from Qt Examples:
    Qt Code:
    1. #ifndef QT_NO_OPENSSL
    2. void HttpWindow::sslErrors(const QList<QSslError> &errors)
    3. {
    4. QString errorString;
    5. foreach (const QSslError &error, errors) {
    6. if (!errorString.isEmpty())
    7. errorString += ", ";
    8. errorString += error.errorString();
    9. }
    10.  
    11. if (QMessageBox::warning(this, tr("HTTP Example"),
    12. tr("One or more SSL errors has occurred: %1").arg(errorString),
    13. QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
    14. http->ignoreSslErrors();
    15. }
    16. }
    17. #endif
    To copy to clipboard, switch view to plain text mode 

    as you see it's surrounded by
    Qt Code:
    1. #ifndef QT_NO_OPENSSL
    2. // . . .
    3. #endif
    To copy to clipboard, switch view to plain text mode 

    so if you compile Qt without SSL support then this example still work but can't handle SSL connections (QT_NO_OPENSSL will be defined so that code would be, let's say, cut out). You said that you need to download files from server with SSL - and it's not working, but it's working for non-SSL connections, so the reason would be in QT_NO_OPENSSL is defined == Qt built without OpenSSL.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  9. #9
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qssl

    What's more, same thing you can see in qsslsocket.h:
    Qt Code:
    1. #ifndef QT_NO_OPENSSL
    2.  
    3. class QDir;
    4. class QSslCipher;
    5. class QSslCertificate;
    6. class QSslConfiguration;
    7.  
    8. class QSslSocketPrivate;
    9. class Q_NETWORK_EXPORT QSslSocket : public QTcpSocket
    10. {
    11. // . . .
    12. };
    13.  
    14. #endif // QT_NO_OPENSSL
    To copy to clipboard, switch view to plain text mode 

    So there is no class QSslSocket if you didn't build your Qt with OpenSSL.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  10. #10
    Join Date
    Feb 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Post Re: Qssl

    that mean if i build qt with openssl , can i download files from server with out change of http example program..(../qt/4.4.1/examples/network/http).

    i am new to qt. could u plz tell me how to buid qt with openssl?

  11. #11
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qssl

    yes, there is no needed to change your example, just rebuild it.
    there are to options how to build it:
    -- download sources and then build them.
    -- download www.openssl.org/related/binaries.html.

    the second option is easier.
    then all you need it's set environment variables for OpenSSL.
    SET LIB=D:\develop\OpenSSL\lib\VC;%LIB% -- if you use MS VS or
    SET LIB=D:\develop\OpenSSL\lib\MinGW;%LIB% -- if you use MinGW
    SET INCLUDE=D:\develop\OpenSSL\include;%INCLUDE%
    the next step -- you need to configure your Qt.
    there are to configure options:
    -openssl ........... Compile in run-time OpenSSL support
    -openssl-linked .... Compile in linked OpenSSL support
    I preferred then first option.
    that's all.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  12. #12
    Join Date
    Feb 2009
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Post Re: Qssl

    thank you very much, thanks a lot for u r great infromation. i'll try as u told

  13. #13
    Join Date
    Jun 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qssl

    Hi,

    Im also facing the similar problem from a couple of days. I want to set openssl support for qt 4.5 on winxp sp2 machine

    I configured as
    configure -openssl -I C:\OpenSSL\include\openssl -L C:\OpenSSL\lib\MinGW -webkit

    then did mingw32-make

    still i get errors when make is done on ssl folder of qt
    meanwhile after configure is done, if i open makefile in C:\Qt\2009.01\qt, it still doest show openssl includes and libs i supplied with configure.

    Im a newbie and im facing this issue for quite some time now.
    Kindly let me know where im getting wrong. I followed the above mentioned steps (previous posts)
    Please provide me exact steps of building qt 4.5 with openssl.

    Thanks,
    Srikanth

  14. #14
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qssl

    try to set path to OpenSSL includes using
    SET INCLUDE=D:\develop\OpenSSL\include;%INCLUDE%
    not using
    configure -openssl -I C:\OpenSSL\include\openssl -L C:\OpenSSL\lib\MinGW
    .
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  15. #15
    Join Date
    Jun 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qssl

    Hi,

    Im also facing the similar problem from a couple of days. I want to set openssl support for qt 4.5 on winxp sp2 machine

    I configured as
    configure -openssl -I C:\OpenSSL\include\openssl -L C:\OpenSSL\lib\MinGW -webkit

    then did mingw32-make

    still i get errors when make is done on ssl folder of qt
    meanwhile after configure is done, if i open makefile in C:\Qt\2009.01\qt, it still doest show openssl includes and libs i supplied with configure.

    Im a newbie and im facing this issue for quite some time now.
    Kindly let me know where im getting wrong. I followed the above mentioned steps (previous posts)
    Please provide me exact steps of building qt 4.5 with openssl.

    Thanks,
    Srikanth

  16. #16
    Join Date
    Jun 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qssl

    UPDATE:
    i paste here some errors when mingw32-make is executed after configure


    ssl\qsslcertificate.cpp:441: error: `X509_PUBKEY' undeclared (first use this fun
    ction)
    ssl\qsslcertificate.cpp:441: error: `xkey' undeclared (first use this function)
    ssl\qsslcertificate.cpp:441: error: invalid use of undefined type `struct x509_s
    t'
    ../../include/QtNetwork/../../src/network/ssl/qsslcertificate.h:52: error: forwa
    rd declaration of `struct x509_st'
    ssl\qsslcertificate.cpp:442: error: `EVP_PKEY' undeclared (first use this functi
    on)
    ssl\qsslcertificate.cpp:442: error: `pkey' undeclared (first use this function)
    ssl\qsslcertificate.cpp:442: error: `q_X509_PUBKEY_get' undeclared (first use th
    is function)
    ssl\qsslcertificate.cpp:445: error: `EVP_PKEY_RSA' undeclared (first use this fu
    nction)
    ssl\qsslcertificate.cpp:446: error: 'class QSslKeyPrivate' has no member named '
    rsa'
    ssl\qsslcertificate.cpp:446: error: `q_EVP_PKEY_get1_RSA' undeclared (first use
    this function)
    ssl\qsslcertificate.cpp:449: error: `EVP_PKEY_DSA' undeclared (first use this fu
    nction)
    ssl\qsslcertificate.cpp:450: error: 'class QSslKeyPrivate' has no member named '
    dsa'
    ssl\qsslcertificate.cpp:450: error: `q_EVP_PKEY_get1_DSA' undeclared (first use
    this function)
    ssl\qsslcertificate.cpp:453: error: `EVP_PKEY_DH' undeclared (first use this fun
    ction)
    ssl\qsslcertificate.cpp:459: error: `q_EVP_PKEY_free' cannot be used as a functi
    on
    ssl\qsslcertificate.cpp: In static member function `static QSslCertificate QSslC
    ertificatePrivate::QSslCertificate_from_X509(X509* )':
    ssl\qsslcertificate.cpp:666: error: `q_X509_get_issuer_name' undeclared (first u
    se this function)
    ssl\qsslcertificate.cpp:666: error: `q_X509_NAME_oneline' cannot be used as a fu
    nction
    ssl\qsslcertificate.cpp:668: error: `q_X509_get_subject_name' undeclared (first
    use this function)
    ssl\qsslcertificate.cpp:668: error: `q_X509_NAME_oneline' cannot be used as a fu
    nction
    ssl\qsslcertificate.cpp:670: error: `ASN1_TIME' undeclared (first use this funct
    ion)
    ssl\qsslcertificate.cpp:670: error: `nbef' undeclared (first use this function)
    ssl\qsslcertificate.cpp:670: error: `X509_get_notBefore' undeclared (first use t
    his function)
    ssl\qsslcertificate.cpp:671: error: `naft' undeclared (first use this function)
    ssl\qsslcertificate.cpp:671: error: `X509_get_notAfter' undeclared (first use th
    is function)
    mingw32-make[2]: *** [tmp/obj/debug_shared/qsslcertificate.o] Error 1
    mingw32-make[2]: Leaving directory `C:/Qt/2009.02/qt/src/network'
    mingw32-make[1]: *** [debug-all] Error 2
    mingw32-make[1]: Leaving directory `C:/Qt/2009.02/qt/src/network'
    mingw32-make: *** [sub-network-make_default-ordered] Error 2

  17. #17
    Join Date
    Jun 2009
    Posts
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qssl

    Hi spirit,

    Thanks for the reply, I did as you mentioned.

    added include path to INCLUDE and executed configure as

    configure -openssl -L C:\OpenSSL\lib\MinGW -webkit

    when im done with configure, i executed mingw32-make ans i still get those compilation errors as i mentioned. I still dont see any openssl rules in makefile

    Thanks,
    Srikanth

Similar Threads

  1. Qt4.4 QSsl Won't Compile with MSVC2008
    By Surye in forum Installation and Deployment
    Replies: 2
    Last Post: 9th May 2008, 17:52

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.