PySide6.QtWebEngineCore.QWebEngineClientCertificateStore¶
- class QWebEngineClientCertificateStore¶
QWebEngineClientCertificateStore
类提供了一个用于存储客户端证书的内存存储。 更多…概要¶
方法¶
def
add()
def
certificates()
def
clear()
def
remove()
注意
本文档可能包含从C++自动翻译到Python的代码片段。我们始终欢迎对代码片段翻译的贡献。如果您发现翻译问题,您也可以通过在我们的https:/bugreports.qt.io/projects/PYSIDE上创建工单来告知我们。
详细描述¶
该类允许将客户端证书存储在内存存储中。当网站请求SSL客户端证书时,会发出
selectClientCertificate
信号,并从本地证书存储或内存存储中提供匹配的证书。可以通过
clientCertificateStore()
方法获取类实例。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);
- add(certificate, privateKey)¶
- Parameters:
证书 –
QSslCertificate
privateKey –
QSslKey
将带有
privateKey
的certificate
添加到内存中的客户端证书存储中。- certificates()¶
- Return type:
返回内存存储中的客户端证书列表。如果存储中不包含任何证书,则返回空列表。
- clear()¶
从内存存储中清除所有客户端证书。
- remove(certificate)¶
- Parameters:
证书 –
QSslCertificate
删除内存中客户端证书存储中与证书
certificate
匹配的所有实例。