本文整理汇总了C++中QXmppConfiguration::sslPrivateKey方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppConfiguration::sslPrivateKey方法的具体用法?C++ QXmppConfiguration::sslPrivateKey怎么用?C++ QXmppConfiguration::sslPrivateKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppConfiguration
的用法示例。
在下文中一共展示了QXmppConfiguration::sslPrivateKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectToHost
void QXmppOutgoingClientPrivate::connectToHost(const QString &host, quint16 port)
{
q->info(QString("Connecting to %1:%2").arg(host, QString::number(port)));
// override CA certificates if requested
if (!config.caCertificates().isEmpty())
q->socket()->setCaCertificates(config.caCertificates());
// set private key and certificate if available
if (!config.sslPrivateKey().isNull())
{
q->socket()->setPrivateKey(config.sslPrivateKey());
}
if (!config.localSslCertificate().isNull())
{
q->socket()->setLocalCertificate(config.localSslCertificate());
}
// respect proxy
q->socket()->setProxy(config.networkProxy());
#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
// set the name the SSL certificate should match
q->socket()->setPeerVerifyName(config.domain());
#endif
// connect to host
const QXmppConfiguration::StreamSecurityMode localSecurity = q->configuration().streamSecurityMode();
if (localSecurity == QXmppConfiguration::LegacySSL) {
if (!q->socket()->supportsSsl()) {
q->warning("Not connecting as legacy SSL was requested, but SSL support is not available");
return;
}
q->socket()->connectToHostEncrypted(host, port);
} else {
q->socket()->connectToHost(host, port);
}
}