Using resource in QSslCertificate::fromPath
-
We are in the process of upgrading from QT 5.15.2 to QT6.5.3 and I've run into a problem that I can't find a solution to.
Previously we loaded our certificates like this:
serverCert_ = QSslCertificate::fromPath(":/certs/server*.pem", QSsl::Pem, QSslCertificate::PatternSyntax::Wildcard);
With our qrc file looking like this:
<RCC> <qresource prefix="/"> <file alias="certs/server.pem">server.pem</file> <file alias="certs/server_next.pem">server_next.pem</file> </qresource> </RCC>
It worked like a charm in 5.15.2 but now that we are trying to use 6.5.3 it doesn't find any of the certificates.
If I try this:
QFile file(":/certs/server.pem"); if(file.open(QIODevice::ReadOnly)) { QByteArray certData = file.readAll(); QSslCertificate certificate(certData, QSsl::Pem); }
it finds the certificate just fine in QT 6.5.3 so the resources and the certificate should be fine.
I can't find any documentation on changes to QSslCertificate::fromPath between the to QT versions other than RegEx has been made obsolete as wildcard syntax.
-
-
Hi, the wildcard file matching has changed I think between Qt 5 and 6, perhaps if you try with an asterisk as the last character, say like this:
Cert_ = QSslCertificate::fromPath(":/certs/server*", QSsl::Pem, QSslCertificate::PatternSyntax::Wildcard);
@hskoglund I just tested your proposal, but unfortunately it didn't work. I also tried without any wildcards and just wrote out one of the names and that didn't work either.
I'm beginning to suspect that fromPath doesn't work with resources but I can't find any proof that it shouldn't