QWebEngineClientCertificateStore Class

Die Klasse QWebEngineClientCertificateStore bietet einen speicherinternen Speicher für Client-Zertifikate. Mehr...

Kopfzeile: #include <QWebEngineClientCertificateStore>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore

Öffentliche Funktionen

void add(const QSslCertificate &certificate, const QSslKey &privateKey)
QList<QSslCertificate> certificates() const
void clear()
void remove(const QSslCertificate &certificate)

Detaillierte Beschreibung

Die Klasse ermöglicht die Speicherung von Client-Zertifikaten in einem In-Memory-Speicher. Wenn eine Website ein SSL-Client-Zertifikat anfordert, wird das Signal QWebEnginePage::selectClientCertificate mit passenden Zertifikaten aus dem nativen Zertifikatspeicher oder dem speicherinternen Speicher ausgegeben.

Die Klasseninstanz kann mit der Methode QWebEngineProfile::clientCertificateStore() erhalten werden.

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);

Dokumentation der Mitgliedsfunktionen

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

Fügt dem speicherinternen Client-Zertifikatspeicher ein certificate mit der Adresse privateKey hinzu.

QList<QSslCertificate> QWebEngineClientCertificateStore::certificates() const

Gibt eine Liste der Client-Zertifikate im speicherinternen Speicher zurück. Gibt eine leere Liste zurück, wenn der Speicher keine Zertifikate enthält.

void QWebEngineClientCertificateStore::clear()

Löscht alle Client-Zertifikate aus dem Zwischenspeicher.

void QWebEngineClientCertificateStore::remove(const QSslCertificate &certificate)

Löscht alle Instanzen des Client-Zertifikats im speicherinternen Client-Zertifikatspeicher, die mit dem Zertifikat certificate übereinstimmen.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.