Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QSslKey loading issue on MAC/iOS - Private Key Invalid
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.
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 ?
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.
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.
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
What is the issue you have on OSX and iOS ? Do let me know. I can help. Your email id bounced.
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.
Mena last edited by
@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:
But still the the service stops after a couple of seconds after turning screen Off with USB not connected!
This post is deleted!