I have Qt 5.4.0 on Windows 8.1 and Qt 5.4.2 on ArchLinux latest and get exactly the same result.

I have web-site which requires client SSL certificate. Server seems to be configured properly since execution of

Qt Code:
  1. openssl s_client -connect myserver:443 -cert client.crt -key client.key
To copy to clipboard, switch view to plain text mode 

prints

Qt Code:
  1. Verify return code: 0 (ok)
To copy to clipboard, switch view to plain text mode 

Also,

Qt Code:
  1. curl --cert client.pem https://myserver/
To copy to clipboard, switch view to plain text mode 

works just fine.

Server certificate is valid, browsers accept it, etc. Client certificate is self signed. Just in case, server is nginx and here is relevant config fragment
Qt Code:
  1. listen *:443 ssl;
  2.  
  3. server_name myserver;
  4.  
  5. ssl on;
  6. ssl_certificate /etc/nginx/ssl/myserver.crt;
  7. ssl_certificate_key /etc/nginx/ssl/myserver.key;
  8. ssl_dhparam /etc/nginx/ssl/myserver.dh;
  9. ssl_protocols TLSv1.1 TLSv1.2;
  10. ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
  11. ssl_prefer_server_ciphers on;
  12. ssl_client_certificate /etc/nginx/ssl/ca.crt;
  13. ssl_verify_client on;
To copy to clipboard, switch view to plain text mode 

But the following simplest Qt5 application
Qt Code:
  1. #include <qcoreapplication.h>
  2. #include <qfile.h>
  3. #include <qnetworkaccessmanager.h>
  4. #include <qnetworkconfiguration.h>
  5. #include <qnetworkproxy.h>
  6. #include <qnetworkreply.h>
  7. #include <qnetworkrequest.h>
  8. #include <qsslcertificate.h>
  9. #include <qsslconfiguration.h>
  10. #include <qsslkey.h>
  11.  
  12. int main(int argc, char *argv[])
  13. {
  14. QCoreApplication a(argc, argv);
  15.  
  16. QNetworkProxyFactory::setUseSystemConfiguration(true);
  17.  
  18. QSslConfiguration sslConfiguration;
  19.  
  20. QFile privateKeyFile("client.key");
  21. privateKeyFile.open(QIODevice::ReadOnly);
  22.  
  23. QFile certificateFile("client.crt");
  24. certificateFile.open(QIODevice::ReadOnly);
  25.  
  26. QSslKey privateKey(&privateKeyFile, QSsl::Opaque);
  27. QSslCertificate certificate(&certificateFile);
  28.  
  29. qWarning() << QSslSocket::supportsSsl();
  30. qWarning() << certificate.serialNumber();
  31. qWarning() << certificate.subjectInfo(QSslCertificate::CommonName);
  32. qWarning() << certificate.expiryDate();
  33.  
  34. sslConfiguration.setPrivateKey(privateKey);
  35. sslConfiguration.setLocalCertificate(certificate);
  36.  
  37. QNetworkRequest networkRequest(QUrl("https://server/"));
  38.  
  39. networkRequest.setSslConfiguration(sslConfiguration);
  40.  
  41. QNetworkAccessManager networkAccessManager;
  42.  
  43. QNetworkReply* networkReply = networkAccessManager.get(networkRequest);
  44.  
  45. QEventLoop loop;
  46.  
  47. QObject::connect(&networkAccessManager, &QNetworkAccessManager::finished, &loop, &QEventLoop::quit);
  48.  
  49. loop.exec();
  50.  
  51. qWarning() << networkReply->error();
  52. qWarning() << networkReply->errorString();
  53.  
  54. delete networkReply;
  55.  
  56. return a.exec();
  57. }
To copy to clipboard, switch view to plain text mode 
fails with the following console output on Windows
Qt Code:
  1. QSslSocket: cannot resolve TLSv1_1_client_method
  2. QSslSocket: cannot resolve TLSv1_2_client_method
  3. QSslSocket: cannot resolve TLSv1_1_server_method
  4. QSslSocket: cannot resolve TLSv1_2_server_method
  5. QSslSocket: cannot resolve SSL_select_next_proto
  6. QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
  7. QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
  8. true
  9. "01"
  10. ("AA-00-00-00")
  11. QDateTime("2035-06-21 21:41:13.000 UTC Qt::UTC")
  12. 99
  13. "Unable to init SSL Context: "
To copy to clipboard, switch view to plain text mode 
and the following console output on Linux
Qt Code:
  1. true
  2. "01"
  3. ("AA-00-00-00")
  4. QDateTime("2035-06-21 21:41:13.000 UTC Qt::UTC")
  5. 99
  6. "Unable to init SSL Context: "
To copy to clipboard, switch view to plain text mode 

If I remove "networkRequest.setSslConfiguration(sslConfigurati on);" I just get 400 error from server stating I need to send client certificate.

Adding "sslConfiguration.setPeerVerifyMode(QSslSocket::Ve rifyNone);" changes nothing.

I will be happy to get any advice what can be cause of Qt5 code failure.