Hello,

I am currently porting an application to iOS which contains a SSL-Socket including cert- and keyfile.
The application runs fine on desktop machines cross multiple platforms, but on the iOS i get the
following SSL-Error: "The root CA certificate is not trusted for this purpose". I could just ignore
it (tried and worked as expected), but that does not seem to be the clear solution I am looking for.
The certificates are self signed, but when running the application on Windows, Linux and OS X Yosemite
it runs just fine.

Any ideas why this is only occuring on iOs and how I can solve the issue?


This is the part where i configure the SSL-socket:

Qt Code:
  1. void SslClient::configureSsl()
  2. {
  3. /* Read and set certfile */
  4. QFile certFile(":/ssl/ssl/client.pem", this);
  5. if (!certFile.open(QIODevice::ReadOnly)) {
  6. qDebug() << "Error opening cert-File";
  7. }
  8. QSslCertificate sslCertificate(&certFile, QSsl::Pem);
  9. if (sslCertificate.isNull()) {
  10. qDebug() << "Certificate is empty";
  11. }
  12.  
  13. /* Read and set keyfile */
  14. QFile keyFile(":/ssl/ssl/client.key", this);
  15. if (!keyFile.open(QIODevice::ReadOnly)) {
  16. qDebug() << "Error opening key-File";
  17. }
  18. QSslKey sslKey(&keyFile, QSsl::Rsa, QSsl::Pem);
  19. if (sslKey.isNull()) {
  20. qDebug() << "Keyfile is empty";
  21. }
  22.  
  23. /* Set the configuration */
  24. sslConfig.setLocalCertificate(sslCertificate);
  25. sslConfig.setPrivateKey(sslKey);
  26. sslConfig.setPeerVerifyMode(QSslSocket::VerifyNone);
  27. sslConfig.setProtocol(QSsl::TlsV1SslV3);
  28. setSslConfiguration(sslConfig);
  29. }
To copy to clipboard, switch view to plain text mode 


thank you in advance.