QWebEngineCertificateError Class

The QWebEngineCertificateError class provides information about a certificate error. More...

Header: #include <QWebEngineCertificateError>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
In QML: webEngineCertificateError

Public Types

enum Type { Ok, SslPinnedKeyNotInCertificateChain, CertificateCommonNameInvalid, CertificateDateInvalid, CertificateAuthorityInvalid, …, CertificateSymantecLegacy }

Properties

  • type : const Type
  • url : const QUrl

Public Functions

void acceptCertificate()
QList<QSslCertificate> certificateChain() const
void defer()
QString description() const
bool isMainFrame() const
bool isOverridable() const
void rejectCertificate()
QWebEngineCertificateError::Type type() const
QUrl url() const

Detailed Description

Provides information about a certificate error. This class is used as a parameter of QWebEnginePage::certificateError().

Member Type Documentation

enum QWebEngineCertificateError::Type

This enum describes the type of certificate error encountered.

The values of this enum type match the SSL errors Chromium provides. QSslError::SslError values are not used directly, because the Qt error categories cannot be mapped to the Chromium error categories.

ConstantValueDescription
QWebEngineCertificateError::Ok0There was no actual certificate error.
QWebEngineCertificateError::SslPinnedKeyNotInCertificateChain-150The certificate did not match the built-in public keys pinned for the host name.
QWebEngineCertificateError::CertificateCommonNameInvalid-200The certificate's common name did not match the host name.
QWebEngineCertificateError::CertificateDateInvalid-201The certificate is not valid at the current date and time.
QWebEngineCertificateError::CertificateAuthorityInvalid-202The certificate is not signed by a trusted authority.
QWebEngineCertificateError::CertificateContainsErrors-203The certificate contains errors.
QWebEngineCertificateError::CertificateNoRevocationMechanism-204The certificate has no mechanism for determining if it has been revoked.
QWebEngineCertificateError::CertificateUnableToCheckRevocation-205Revocation information for the certificate is not available.
QWebEngineCertificateError::CertificateRevoked-206The certificate has been revoked.
QWebEngineCertificateError::CertificateInvalid-207The certificate is invalid.
QWebEngineCertificateError::CertificateWeakSignatureAlgorithm-208The certificate is signed using a weak signature algorithm.
QWebEngineCertificateError::CertificateNonUniqueName-210The host name specified in the certificate is not unique.
QWebEngineCertificateError::CertificateWeakKey-211The certificate contains a weak key.
QWebEngineCertificateError::CertificateNameConstraintViolation-212The certificate claimed DNS names that are in violation of name constraints.
QWebEngineCertificateError::CertificateValidityTooLong (since Qt 5.7)-213The certificate has a validity period that is too long.
QWebEngineCertificateError::CertificateTransparencyRequired (since Qt 5.8)-214Certificate Transparency was required for this connection, but the server did not provide CT information that complied with the policy.
QWebEngineCertificateError::CertificateKnownInterceptionBlocked (since Qt 5.15)-217The certificate is known to be used for interception by an entity other the device owner.
QWebEngineCertificateError::SslObsoleteVersion (since Qt 6.2, deprecated in Qt 6.4)-218The connection uses an obsolete version of SSL/TLS.
QWebEngineCertificateError::CertificateSymantecLegacy (since Qt 6.2)-215The certificate is a legacy Symantec one that's no longer valid.

Property Documentation

[read-only] description : const QString

This property holds a short localized human-readable description of the error.

Access functions:

QString description() const

See also url() and isOverridable().

[read-only, since 6.8] isMainFrame : const bool

Returns whether the certificate error comes from the main frame. If false, the error comes from a sub-resource and most likely needs to be rejected without user input.

This property was introduced in Qt 6.8.

Access functions:

bool isMainFrame() const

[read-only] overridable : const bool

This property holds whether this error can be overridden and accepted.

Access functions:

bool isOverridable() const

See also description().

[read-only] type : const Type

This property holds the type of the error.

Access functions:

QWebEngineCertificateError::Type type() const

See also description() and isOverridable().

[read-only] url : const QUrl

This property holds the URL that triggered the error.

Access functions:

QUrl url() const

See also description().

Member Function Documentation

[invokable] void QWebEngineCertificateError::acceptCertificate()

Accepts the certificate and continues the loading of the requested URL.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

QList<QSslCertificate> QWebEngineCertificateError::certificateChain() const

Returns the peer's chain of digital certificates.

Chain starts with the peer's immediate certificate and ending with the CA's certificate.

[invokable] void QWebEngineCertificateError::defer()

Marks the certificate error for delayed handling.

This function should be called when there is a need to postpone the decision whether to accept a certificate, for example, while waiting for user input. When called, the function pauses the URL request until acceptCertificate() or rejectCertificate() is called.

Note: It is only possible to defer overridable certificate errors.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

See also isOverridable().

[invokable] void QWebEngineCertificateError::rejectCertificate()

Rejects the certificate and aborts the loading of the requested URL.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.