IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QWebEngineClientCertificateStore Class

The QWebEngineClientCertificateStore class provides an in-memory store for client certificates.

This class was introduced in Qt 5.13.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QWebEngineClientCertificateStore Class

  • Header: QWebEngineClientCertificateStore

  • Since: Qt 5.13

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)

    target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)

  • qmake: QT += webenginecore

Detailed Description

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 class instance can be obtained with the QWebEngineProfile::clientCertificateStore() method.

 
Sélectionnez
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);

Member Function Documentation

 

void QWebEngineClientCertificateStore::add(const QSslCertificate &certificate, const QSslKey &privateKey)

Adds a certificate with the privateKey to the in-memory client certificate store.

QList<QSslCertificate> QWebEngineClientCertificateStore::certificates() const

Returns a list of the client certificates in the in-memory store. Returns an empty list if the store does not contain any certificates.

void QWebEngineClientCertificateStore::clear()

Clears all the client certificates from the in-memory store.

void QWebEngineClientCertificateStore::remove(const QSslCertificate &certificate)

Deletes all the instances of the client certificate in the in-memory client certificate store that matches the certificate certificate.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+