-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
5.15.0
In simple browser example,
1. Use QSslCertificate::importPkcs12() to import client cert, and add to QWebEngineClientCertificateStore
/browser.cpp
BrowserWindow *Browser::createWindow(bool offTheRecord)
{
...
auto certStore = profile->clientCertificateStore();
QFile keyFile("user.p12");
if (keyFile.open(QIODevice::ReadOnly))
{
QSslKey client_key;
QSslCertificate client_cert;
if (QSslCertificate::importPkcs12(&keyFile, &client_key, &client_cert))
{
certStore->add(client_cert, client_key);
}
}
...
}
2. Check for the client cert in WebPage::handleSelectClientCertificate() slot.
// webpage.cpp void WebPage::handleSelectClientCertificate(QWebEngineClientCertificateSelection selection) { for (auto& cert : selection.certificates()) { ... } }
However only system client certs are in the selection. And if I do not install any client cert to Windows system , the signal will not be emitted at all.