diff options
Diffstat (limited to 'src/core/api/qwebengineclientcertificatestore.cpp')
-rw-r--r-- | src/core/api/qwebengineclientcertificatestore.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/core/api/qwebengineclientcertificatestore.cpp b/src/core/api/qwebengineclientcertificatestore.cpp index e7837afce..3d231c05f 100644 --- a/src/core/api/qwebengineclientcertificatestore.cpp +++ b/src/core/api/qwebengineclientcertificatestore.cpp @@ -20,7 +20,21 @@ QT_BEGIN_NAMESPACE The class allows to store client certificates in an in-memory store. When a web site requests an SSL client certificate, the QWebEnginePage::selectClientCertificate signal is emitted with matching certificates from the native certificate store or the in-memory store. - The getInstance() method can be used to access the single instance of the class. + + The class instance can be obtained with the QWebEngineProfile::clientCertificateStore() method. + + \code + QFile certFile(":/resouces/certificate.crt"); + certFile.open(QIODevice::ReadOnly); + const QSslCertificate cert(certFile.readAll(), QSsl::Pem); + + QFile keyFile(":/resources/privatekey.key"); + keyFile.open(QIODevice::ReadOnly); + const QSslKey sslKey(keyFile.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey, ""); + + QWebEngineProfile profile; + profile.clientCertificateStore()->add(cert, sslKey); + \endcode */ QWebEngineClientCertificateStore::QWebEngineClientCertificateStore(QtWebEngineCore::ClientCertificateStoreData *storeData) @@ -54,7 +68,7 @@ void QWebEngineClientCertificateStore::add(const QSslCertificate &certificate, c QList<QSslCertificate> QWebEngineClientCertificateStore::certificates() const { QList<QSslCertificate> certificateList; - for (auto data : qAsConst(m_storeData->extraCerts)) + for (auto data : std::as_const(m_storeData->extraCerts)) certificateList.append(data->certificate); return certificateList; } |