+void ClientSyncer::ignoreSslWarnings(bool permanently) {
+ QSslSocket *sock = qobject_cast<QSslSocket *>(_socket);
+ if(sock) {
+ // ensure that a proper state is displayed and no longer a warning
+ emit socketStateChanged(sock->state());
+ }
+ if(permanently) {
+ if(!sock)
+ qWarning() << Q_FUNC_INFO << "unable to save cert digest! Socket is either a nullptr or not a QSslSocket";
+ else
+ KnownHostsSettings().saveKnownHost(sock);
+ }
+ emit connectionMsg(_coreMsgBuffer["CoreInfo"].toString());
+ connectionReady();
+}
+
+void ClientSyncer::sslSocketEncrypted() {
+ QSslSocket *socket = qobject_cast<QSslSocket *>(sender());
+ Q_ASSERT(socket);
+
+ // if there were sslErrors we already had extensive error handling
+ // no need to check for a digest change again.
+ if(!socket->sslErrors().isEmpty())
+ return;
+
+ QByteArray knownDigest = KnownHostsSettings().knownDigest(socket);
+ if(knownDigest == socket->peerCertificate().digest()) {
+ connectionReady();
+ return;
+ }
+
+ QStringList warnings;
+ if(!knownDigest.isEmpty()) {
+ warnings << tr("Cert Digest changed! was: %1").arg(QString(prettyDigest(knownDigest)));
+ }
+
+ setWarningsHandler(SLOT(ignoreSslWarnings(bool)));
+ emit connectionWarnings(warnings);
+}
+