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. Using resource in QSslCertificate::fromPath
Forum Updated to NodeBB v4.3 + New Features

Using resource in QSslCertificate::fromPath

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 263 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.
  • T Offline
    T Offline
    Thestrup
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      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);
      
      T 1 Reply Last reply
      0
      • hskoglundH hskoglund

        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);
        
        T Offline
        T Offline
        Thestrup
        wrote on last edited by
        #3

        @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

        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