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. Qt 5 - qnetwork schannel with non-exportable private key.
Forum Updated to NodeBB v4.3 + New Features

Qt 5 - qnetwork schannel with non-exportable private key.

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 366 Views 1 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.
  • S Offline
    S Offline
    Steve82736123
    wrote on last edited by
    #1

    Hi,

    we are evaluating a switch from openssl to the schannel backend (currently still on 5.x). The application is a tcp server and the certificate and private key are in the windows cert store.

    As long as the private key is exportable this seems to be ok by passing the QSslCertificate and QSslKey manually from windows cert store (reading it out via CryptAcquireCertificatePrivateKey) to Qt. But it seems there is no Qt API support for non-exportable keys: with schannel it is not needed to pass the private key via the application boundaries, it could also stay in the OS security context.

    Am I missing something or is this currently not possible with Qt's schannel implementation?

    Thx.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Steve82736123
      wrote on last edited by
      #2

      Looked into the internals (5.x and 6.x - problem is the same):

      On windows with schannel backend and certificates/keys in the windows store the certificates and especially the private keys need to be exported by the application, converted, set as setLocalCert / setPrivateKey, and then internally the Qt schannel implementation generates a temporary windows cert store, imports the stuff, just to get a handle to the cert context.

      For non-exportable keys this approach fails, and also from a security perspective there is no need for the private key to be present in application mem. It would be great to have a way to set

      const CERT_CONTEXT *localCertContext; // qsslsocket_schannel_p.h in qt5 or qtls_schannel_p.h in qt6
      

      from the outside so that acquireCredentialsHandle will directly use this context and pass it to the SCHANNEL_CRED.

      I tried to "poke" it into the object mem, but unfortunately the handshake code calls "reset" right before and sets localCertContext back to nullptr :-)

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        I think this might be worth a feature request. Did you already check the bug report system to see if there's already something there for that ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Steve82736123
          wrote on last edited by
          #4

          Hi, thanks, will enter one - had to understand the problem first.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Steve82736123
            wrote on last edited by
            #5

            https://bugreports.qt.io/browse/QTBUG-131483

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved