QSslSocket::QueryPeer. Will connection encrypted with public key of the quered certificate?
Unsolved
General and Desktop
-
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?