[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdelibs/KDE/4.14] kio/kssl/kcm: Use QSslCertificate's fromDevice instead fromPath to import certifi
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2014-11-17 5:32:31
Message-ID: E1XqEvP-0007Wq-Iy () scm ! kde ! org
[Download RAW message or body]

Git commit 0d9d4ddd35e44ee811b43d93bb8e0968008ffa76 by Dawit Alemayehu.
Committed on 09/11/2014 at 06:13.
Pushed by adawit into branch 'KDE/4.14'.

Use QSslCertificate's fromDevice instead fromPath to import certificates.

QSslCertificate::fromPath seems to have problem importing certs in DER format.

CCBUG: 333079
REVIEW: 121092

M  +7    -3    kio/kssl/kcm/cacertificatespage.cpp

http://commits.kde.org/kdelibs/0d9d4ddd35e44ee811b43d93bb8e0968008ffa76

diff --git a/kio/kssl/kcm/cacertificatespage.cpp b/kio/kssl/kcm/cacertificatespage.cpp
index 0a269a3..c369ac8 100644
--- a/kio/kssl/kcm/cacertificatespage.cpp
+++ b/kio/kssl/kcm/cacertificatespage.cpp
@@ -298,9 +298,13 @@ void CaCertificatesPage::addCertificateClicked()
     foreach (const QString &certFile, certFiles) {
         // trying both formats is easiest to program and most user-friendly if somewhat sloppy
         const int prevCertCount = certs.count();
-        certs += QSslCertificate::fromPath(certFile, QSsl::Pem);
-        if (prevCertCount == certs.count()) {
-            certs += QSslCertificate::fromPath(certFile, QSsl::Der);
+        QFile file (certFile);
+        if (file.open(QIODevice::ReadOnly)) {
+            certs += QSslCertificate::fromDevice(&file, QSsl::Pem);
+            if (prevCertCount == certs.count()) {
+                file.reset();
+                certs += QSslCertificate::fromDevice(&file, QSsl::Der);
+            }
         }
         if (prevCertCount == certs.count()) {
             kDebug(7029) << "failed to load certificate file" << certFile;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic