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. QSslSocket::QueryPeer. Will connection encrypted with public key of the quered certificate?
Qt 6.11 is out! See what's new in the release blog

QSslSocket::QueryPeer. Will connection encrypted with public key of the quered certificate?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 246 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.
  • B Offline
    B Offline
    BrMisha
    wrote on last edited by
    #1

    Hello!
    I'm using QWebSocketServer to accept connections from clients using their certificates:

    QList<QSslCertificate>	usersCertificates; // add here certificates of all users.
    
    QSslConfiguration	sslConfiguration;
    sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyPeer);
    sslConfiguration.setCaCertificates(usersCertificates);
    server.setSslConfiguration(sslConfiguration);
    

    So, i'm sure that connection established with verified clients. But in this case i need to set ssl settings to server every time i add new user.
    Can i use QSslSocket::QueryPeer and check certificate is allowed after establish connection? For example:

    QList<QSslCertificate>	usersCertificates; // add here certificates of all users.
    
    QSslConfiguration	sslConfiguration;
    sslConfiguration.setPeerVerifyMode(QSslSocket::QueryPeer);
    server.setSslConfiguration(sslConfiguration);
    
    // ... got new connection
    auto socket = server.nextPendingConnection()
    auto certificate = socket->sslConfiguration().peerCertificate()
    if (usersCertificates.contains(certificate)) {
     //user is verified
    }
    

    Is it safety? Will connection encrypted with public key of user?

    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