WebEngineCertificateError QML Type

用于忽略证书错误或拒绝错误证书的实用程序类型。更多

Import Statement: import QtWebEngine
Since: QtWebEngine 1.1
In C++: QWebEngineCertificateError

属性

方法

详细说明

此 QML 类型包含发生证书错误的相关信息。type 属性包含发生错误的原因,description 属性包含错误的简短本地化描述。url 属性包含引发错误的 URL。

可以通过调用rejectCertificate() 来拒绝证书,这将停止加载网络引擎请求。默认情况下,无效证书将被自动拒绝。

可以通过调用acceptCertificate() 忽略证书错误,这样就可以继续加载请求。

调用defer() 可以推迟拒绝证书的决定,这在等待用户输入时非常有用。

另请参阅 WebEngineView::certificateError

属性文档

description : string [read-only]

对错误的简短本地化人可读描述。


overridable : bool [read-only]

一个布尔值,表示证书错误是否可被覆盖和忽略。


type : enumeration [read-only]

错误类型。

常量说明
WebEngineCertificateError.SslPinnedKeyNotInCertificateChain证书与主机名的内置公钥不匹配。
WebEngineCertificateError.CertificateCommonNameInvalid证书通用名与主机名不匹配。
WebEngineCertificateError.CertificateDateInvalid证书在当前日期和时间无效。
WebEngineCertificateError.CertificateAuthorityInvalid证书未由可信机构签署。
WebEngineCertificateError.CertificateContainsErrors证书包含错误。
WebEngineCertificateError.CertificateNoRevocationMechanism证书没有确定是否已被吊销的机制。
WebEngineCertificateError.CertificateUnableToCheckRevocation证书的撤销信息不可用。
WebEngineCertificateError.CertificateRevoked证书已被废止。
WebEngineCertificateError.CertificateInvalid证书无效。
WebEngineCertificateError.CertificateWeakSignatureAlgorithm证书使用弱签名算法签名。
WebEngineCertificateError.CertificateNonUniqueName证书中指定的主机名不唯一。
WebEngineCertificateError.CertificateWeakKey证书包含弱密钥。
WebEngineCertificateError.CertificateNameConstraintViolation证书声称的 DNS 名称违反名称限制。
WebEngineCertificateError.CertificateValidityTooLong证书有效期过长。(在 5.7 中添加)
WebEngineCertificateError.CertificateTransparencyRequired此连接需要证书透明度,但服务器没有提供符合策略的 CT 信息。(已在 5.8 中添加)
WebEngineCertificateError.CertificateKnownInterceptionBlocked已知证书被设备所有者以外的实体用于拦截。(已在 5.15 中添加)

url : url [read-only]

引发错误的 URL。


方法文档

void acceptCertificate()

证书错误将被忽略,网络引擎视图将继续加载请求的 URL。


void defer()

当需要推迟决定是否忽略证书错误时,例如在等待用户输入时,应调用此函数。调用该函数时,URL 请求会暂停,直到acceptCertificate() 或rejectCertificate() 被调用。


void rejectCertificate()

证书被拒绝后,网络引擎视图将停止加载请求的 URL。


© 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.