Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-64495

QSslKey: Algorithm is not set correctly to opaque when constructing from a handle

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.9.0, 5.9.1, 5.9.2
    • Network: SSL
    • None

    Description

      When building a QSslKey from a handle (the handle referring to an openssl EVP_PKEY) in Qt 5.9.*, the algorithm is not always set to QSsl::Opaque.

      We have the case where we build a QSslKey from an EVP_PKEY which is a private key on a smartcard (accessed via p11) and with Qt 5.9.*, when we return that QSslKey from a method, the algorithm is set to QSsl::Rsa. This is an issue because when we call the handle() method on the QSslKey, we get a dummy RSA key that we can't use with the p11 interface anymore.

      Please note that 5.7.0 and 5.7.1 didn't have this issue.

      With the following code:

      QSslKey loadKey()
      {
          EVP_PKEY *k = NULL;
          QSslKey key;
      
          // Load k
          // k = ENGINE_load_private_key(...);
      
          key = QSslKey(Qt::HANDLE(k));
      
          return key;
      }
      
      void sign()
      {
          QSslKey key;
      
          // ...
      
          key = loadKey();
      
          qDebug() << key;
      }
      

      We get the following output when building with Qt 5.9.2:

      QSslKey(PrivateKey, RSA, 2048)

       

      And the following output when building with Qt 5.7.1 (expected behavior):

      QSslKey(PrivateKey, OPAQUE, -1)

       

       See comment below and attachments for a minimal, complete, and verifiable example.

       

       

      Attachments

        1. main.cpp
          0.7 kB
        2. private.pem
          2 kB
        For Gerrit Dashboard: QTBUG-64495
        # Subject Branch Project Status CR V

        Activity

          People

            cnn Qt Core & Network
            r.gaillard Romain Gaillard
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change