Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSslKey loading issue on MAC/iOS - Private Key Invalid
Forum Updated to NodeBB v4.3 + New Features

QSslKey loading issue on MAC/iOS - Private Key Invalid

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 2.7k Views 3 Watching
  • 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.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Qt Champions 2022
    wrote on last edited by
    #1

    Hi

    I have used openSSL library and integrated in to my project. I have generated the SSLCertificate and SSL key programmatically.

    Code snippet -
    QSslCertificate localCertificate = QSslCertificate(QByteArray(buffer, size));
    QSslKey privateKey = QSslKey(keyByteArray, QSsl::Rsa,QSsl::Der);

    Issue - privateKey is coming as INVALID. keyByteArray has the appropriate key data. I'm able to print, check the size etc. Only QSsslKey is coming as invalid.

    Any hints ?

    localCertificate is VALID. I thought it is problem with openSSL library on MAC. If I use openssl command line on mac to generate the certificate and key, it works perfectly.

    Dheerendra
    @Community Service
    Certified Qt Specialist
    http://www.pthinks.com

    1 Reply Last reply
    4
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Update -

      I programatically created the certificate and key on the MacOS. I tried to use them on the MacOS. It did not work.

      I transferred the key & certificate from MacOS to Windows System. I tried to use them. Both of them worked on Window OS

      This indicates that Certificate & Key are valid.

      MacOS must be causing some issue.

      Any inputs ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      5
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        Update -

        I tried changing the openSSL library to latest version and tried the same. Still I am not able build QSslkey on MacOS using the key generated programatically.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        4
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by dheerendra
          #4

          Finally I'm able to get the Certificate & Key working with iOS & MacOS. It was OpenSSLlibrary compatibility and New API set issue. If any body in the forum needs details about this library etc, I can send an email of the pre-compiled library & program as well.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          7
          • M Offline
            M Offline
            Marek
            wrote on last edited by
            #5

            Hi

            I'm struggling with similar issue now. I have self-signed cert and key and I can't load the key. They work just fine on Linux, Android, Windows but not on iOS. It looks like this is somehow related.
            I'm using Qt 5.7 with "iOS Secure Transport, iOS 10.2"
            Earlier I was using openSSL compiled for iOS with qt 5.4 but there was always some issue when I was sending app to AppStore.
            I would like to know more how to deal with it, my email is marek.florianczyk in domain gmail.com

            Best Regards
            Marek

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #6

              @Marek
              What is the issue you have on OSX and iOS ? Do let me know. I can help. Your email id bounced.

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply
              1
              • M Offline
                M Offline
                Marek
                wrote on last edited by
                #7

                Hi

                Thanks for answer. I have already solved my problem, I have reported this bug
                and it turned out that I need to prepare private key in different more SSLeay format, now my apps run on iOS with no problem.

                Best Regards
                Marek

                M 1 Reply Last reply
                1
                • M Marek

                  Hi

                  Thanks for answer. I have already solved my problem, I have reported this bug
                  and it turned out that I need to prepare private key in different more SSLeay format, now my apps run on iOS with no problem.

                  Best Regards
                  Marek

                  M Offline
                  M Offline
                  Mena
                  wrote on last edited by
                  #8

                  @Marek Please can you help me with the android service problem? The one you had, which is:
                  Android service stops working in the background when the screen is Off + USB cable not connected.

                  I tried this:

                  powerManager = (PowerManager) getSystemService(POWER_SERVICE);
                  wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
                   "MyWakelockTag");
                  
                  wakeLock.acquire();
                  

                  and added the permission in manifest:

                  <uses-permission android:name="android.permission.WAKE_LOCK"/>
                  

                  But still the the service stops after a couple of seconds after turning screen Off with USB not connected!

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    Marek
                    wrote on last edited by
                    #9
                    This post is deleted!
                    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