Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. SslKey on iOS, cannot read private key
Forum Update on Monday, May 27th 2025

SslKey on iOS, cannot read private key

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kolegs
    wrote on 2 Jun 2016, 08:32 last edited by kolegs 6 Feb 2016, 16:42
    #1

    Hi,

    I created SslServer using Qt and client, which works just fine on Ubuntu. The problem is when I try to port it to iOS.

    When I try to connect I get error on client console: QAbstractSocket::SslInvalidUserDataError
    After some more investigation I found out that iOS cannot load SslKey. It means I cannnot create correct QSslKey object. I can read the file with key, but when I run code:

    QFile file;
    file.setFileName(keyFilePath);
    file.open(QIODevice::ReadOnly);
    QSslKey key(file.readAll(), QSsl::Rsa);
    file.seek(0);
    qDebug() << key << file.readAll();
    file.close();
    

    What I get is

    QSslKey(PrivateKey, RSA, -1) "----- BEGIN PRIVATE KEY-----
    ....
    \n-----END PRIVATE KEY-----\n"
    

    So it looks like Qt cannot read key
    Any ideas?

    EDIT: I forgot, the keys are self-signed, maybe that is the problem?

    EDIT2: Just checked, it also works on Android

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Jun 2016, 21:44 last edited by
      #2

      Hi,

      Which version of Qt are you using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kolegs
        wrote on 3 Jun 2016, 08:45 last edited by kolegs 6 Mar 2016, 08:45
        #3

        I tried both 5.5 and 5.6. And according to the documentation this versions are using Apple's Secure Transport API, what I can confirm using methods:

        QSslSocket::supportsSsl()
        QSslSocket::sslLibraryVersionString()
        QSslSocket::sslLibraryBuildVersionString(
        

        Also I checked that changing my server peer verification to VerifyNone works just fine. The problem is that iOS cannot load my ssl key and because of that server cannot verify user.

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Pradeep P N
          wrote on 1 Dec 2016, 08:57 last edited by
          #4

          Hi,

          Any one found the solution for this ?
          Even i am facing the same issue in iOS.

          Version Details :-
          Qt 5.6.2
          XCode 8.1
          iOS 10.1

          Thanks.

          Pradeep Nimbalkar.
          Upvote the answer(s) that helped you to solve the issue...
          Keep code clean.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kolegs
            wrote on 1 Dec 2016, 10:05 last edited by
            #5

            You can try this project: link

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved