当前位置: 首页>>代码示例>>C++>>正文


C++ QSslSocket::peerVerifyName方法代码示例

本文整理汇总了C++中QSslSocket::peerVerifyName方法的典型用法代码示例。如果您正苦于以下问题:C++ QSslSocket::peerVerifyName方法的具体用法?C++ QSslSocket::peerVerifyName怎么用?C++ QSslSocket::peerVerifyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSslSocket的用法示例。


在下文中一共展示了QSslSocket::peerVerifyName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sslErrors

void LanLinkProvider::sslErrors(const QList<QSslError>& errors)
{
    QSslSocket* socket = qobject_cast<QSslSocket*>(sender());
    if (!socket) return;
    disconnect(socket, SIGNAL(encrypted()), this, SLOT(encrypted()));
    disconnect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>)));

    foreach(const QSslError &error, errors) {
        qCDebug(KDECONNECT_CORE) << "SSL Error :" << error.errorString();
        switch (error.error()) {
            case QSslError::CertificateSignatureFailed:
            case QSslError::CertificateNotYetValid:
            case QSslError::CertificateExpired:
            case QSslError::CertificateUntrusted:
            case QSslError::SelfSignedCertificate: {
                qCDebug(KDECONNECT_CORE) << "Unpairing device due to " << error.errorString();
                // Due to simultaneous multiple connections, it may be possible that device instance does not exist anymore
                Device *device = Daemon::instance()->getDevice(socket->peerVerifyName());
                if (device != Q_NULLPTR) {
                    device->unpair();
                }
                break;
            }
            default:
                continue;
                // Lots of warnings without this

        }
    }
开发者ID:abhinandh,项目名称:kdeconnect-kde,代码行数:29,代码来源:lanlinkprovider.cpp

示例2: sslErrors

void LanLinkProvider::sslErrors(const QList<QSslError>& errors)
{
    QSslSocket* socket = qobject_cast<QSslSocket*>(sender());
    if (!socket) return;

    disconnect(socket, &QSslSocket::encrypted, this, &LanLinkProvider::encrypted);
    disconnect(socket, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>)));

    Q_FOREACH (const QSslError &error, errors) {
        switch (error.error()) {
            case QSslError::CertificateSignatureFailed:
            case QSslError::CertificateNotYetValid:
            case QSslError::CertificateExpired:
            case QSslError::CertificateUntrusted:
            case QSslError::SelfSignedCertificate: {
                qCDebug(KDECONNECT_CORE) << "Failing due to " << error.errorString();
                // Due to simultaneous multiple connections, it may be possible that device instance does not exist anymore
                Device *device = Daemon::instance()->getDevice(socket->peerVerifyName());
                if (device != Q_NULLPTR) {
                    device->unpair();
                }
                break;
            }
            default:
                continue;
        }
    }

    delete receivedIdentityPackages.take(socket).np;
    // Socket disconnects itself on ssl error and will be deleted by deleteLater slot, no need to delete manually
}
开发者ID:KDE,项目名称:kdeconnect-kde,代码行数:31,代码来源:lanlinkprovider.cpp


注:本文中的QSslSocket::peerVerifyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。