Results 1 to 10 of 10

Thread: SSL Problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2012
    Location
    India
    Posts
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Re: SSL Problem

    Hi All,

    I am new in Qt programming, i need your help to resolve an issue.
    I want to display certificate information of secured website in "Qt demo brower", for this i write code to display but i am unable to get "defaultCaCertificate", "caCertificate" and "peerCertificateChain".
    Do we need any type of initilization before using these APIs ?

    Every time when i call below code it retrive 0 items in dCaCertificates.
    QList<QSslCertificate> dCaCertificates = QSslSocket::defaultCaCertificates();

    But i am able to get system certificates using below code:
    QList<QSslCertificate> sysCertificates = QSslSocket::systemCaCertificates();

    Please help me, its urgent.

    Regards,
    Pranay

  2. #2
    Join Date
    Mar 2012
    Location
    India
    Posts
    5
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: SSL Problem

    Hi Pranay,

    If you want to get and display certificate details in Qt demo browser, here is the code:
    First of all to peerCertificateChain details, one can use the SLOT sslError, the argument within this SLOT named QNetworkReply have all the details of peerCertificateChain and peerCertificate.

    void NetworkAccessManager::sslError(QNetworkReply *reply, const QList<QSslError> &error)
    {
    QList<QSslCertificate> peerCertificateChain = reply->sslConfiguration().peerCertificateChain();
    }

    Thanks & Regards,
    Software

  3. #3
    Join Date
    Jan 2013
    Posts
    11
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: SSL Problem

    @10ventura
    Just signed up to say thank-you for your Implementation of Subclassing QNetworkAccessManager, after doing that, this resolved my problem.

    However my problem of getting "Invalid SSL Handshake" was when i tried moving my class which was using QNetworkAccessManager to another thread that subclassed QObject (for signals and slots) using className->moveToThread(threadName).

    If i didn't move to another thread my SLOT to receive SSL Errors worked and was able to "reply->setIgnoreSSLErrors".

    Regardless of the different situation,

    Thank you again :-)


    EDIT: After doing this i was able to receive a reply, however after receiving.. my connect(manager, SIGNAL(finished(QNetworkReply*)), manager, SLOT(deleteLater())); would cause my program to crash..
    After removing the line, it doens't crash. Any thoughts?

    2nd Edit: I use this new Subclass of QNetworkAccessManager by creating a new class every time i make new requests. Only the first time it is called, having the slot connected to delete the manager is it crashing the program, further on when a new instance of class is created, it connects and deletes the manager without crashing..

    NetworkAccessManager *manager = new NetworkAccessManager();
    //connect(manager, SIGNAL(finished(QNetworkReply*)), manager, SLOT(deleteLater())); //This line causes program to terminate/crash
    connect(manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)) , this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));

    ..then later when i make another request
    NetworkAccessManager *manager = new NetworkAccessManager();
    connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(getAlbumCoverImageDataReply(QNetworkReply*))) ;
    connect(manager, SIGNAL(finished(QNetworkReply*)), manager, SLOT(deleteLater())); //doesn't crash app?
    connect(manager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)) , this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));


    Thanks.
    Last edited by zerokewl; 26th August 2013 at 05:37.

Similar Threads

  1. Very strange socket programming problem
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 11th November 2008, 12:05
  2. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 14:38
  3. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  4. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.