SslKey on iOS, cannot read private key
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
EDIT: I forgot, the keys are self-signed, maybe that is the problem?
EDIT2: Just checked, it also works on Android
Which version of Qt are you using ?
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.
Pradeep P N
Any one found the solution for this ?
Even i am facing the same issue in iOS.
Version Details :-
You can try this project: link