本文整理汇总了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
}
}
示例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
}