From a759cdf678c80837a3737dac7a0c0cfb42329720 Mon Sep 17 00:00:00 2001 From: Thmoas Posch Date: Mon, 29 Aug 2016 20:40:36 +0200 Subject: [PATCH] Device::encryptionInfo returned the entire certificate instead of the hash BUG: 367897 --- core/device.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/core/device.cpp b/core/device.cpp index fb89cee56..2dc8120da 100644 --- a/core/device.cpp +++ b/core/device.cpp @@ -401,18 +401,21 @@ bool Device::isPluginEnabled(const QString& pluginName) const QString Device::encryptionInfo() const { QString result; + QCryptographicHash::Algorithm digestAlgorithm = QCryptographicHash::Algorithm::Sha1; - QString myCertificate = QString::fromLatin1(KdeConnectConfig::instance()->certificate().toDer()); - for (int i=2 ; icertificate().digest(digestAlgorithm).toHex()); + for (int i=2 ; igetDeviceProperty(id(), "certificate"); - for (int i=2 ; igetDeviceProperty(id(), "certificate").toStdString(); + QSslCertificate remoteCertificate = QSslCertificate(QByteArray(remotePem.c_str(), remotePem.size())); + QString remoteSha1 = QString::fromLatin1(remoteCertificate.digest(digestAlgorithm).toHex()); + for (int i=2 ; i