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

List:       kde-commits
Subject:    [libnm-qt/8021x-make-pki-cool] settings: Make cert loading a method on the private class
From:       Will Stephenson <wstephenson () kde ! org>
Date:       2013-05-16 13:56:42
Message-ID: 20130516135642.5E0B3A60AB () git ! kde ! org
[Download RAW message or body]

Git commit 19e5ee7ee91e5efb3b7234c542b5a7e99ebd4097 by Will Stephenson.
Committed on 15/05/2013 at 14:45.
Pushed by wstephens into branch '8021x-make-pki-cool'.

Make cert loading a method on the private class

M  +23   -16   settings/802-1x.cpp
M  +1    -0    settings/802-1x_p.h

http://commits.kde.org/libnm-qt/19e5ee7ee91e5efb3b7234c542b5a7e99ebd4097

diff --git a/settings/802-1x.cpp b/settings/802-1x.cpp
index ae2dc65..7fdf297 100644
--- a/settings/802-1x.cpp
+++ b/settings/802-1x.cpp
@@ -41,6 +41,26 @@ NetworkManager::Settings::CertificateWrapper::~CertificateWrapper()
  {
 }
 
+void NetworkManager::Settings::CertificateWrapper::loadCert(const QString & path, \
NetworkManager::Settings::Security8021xSetting::CertKeyScheme theScheme) +{
+    // http://projects.gnome.org/NetworkManager/developers/api/09/ref-settings.html#idp8706528
 +    // says this can be a PEM or DER encoded file, but QCA only has a method for \
PEM from a file, +    // and i don't feel like doing file access in here myself today
+    QCA::ConvertResult result;
+    cert = QCA::Certificate::fromPEMFile(path, &result);
+    if (result == QCA::ConvertGood) {
+        scheme = theScheme;
+        if (theScheme == \
NetworkManager::Settings::Security8021xSetting::CertKeySchemePath) { +            \
fileName = path; +        } else if ( theScheme == \
NetworkManager::Settings::Security8021xSetting::CertKeySchemeBlob ) { +            \
fileName = QString(); +        }
+    } else {
+        scheme = NetworkManager::Settings::Security8021xSetting::CertKeySchemeNone;
+        cert = QCA::Certificate();
+    }
+}
+
 NetworkManager::Settings::KeyWrapper::KeyWrapper() :
     scheme(Security8021xSetting::CertKeySchemeNone)
 {
@@ -89,7 +109,8 @@ NetworkManager::Settings::Security8021xSetting::Security8021xSetting(const \
Ptr &  d->caCert = other.data()->d_ptr->caCert;
     setSubjectMatch(other->subjectMatch());
     setAltSubjectMatches(other->altSubjectMatches());
-    setClientCertificate(other->clientCertificate());
+    // WILL is this a hack?
+    d->clientCert = other.data()->d_ptr->clientCert;
     setPhase1PeapVersion(other->phase1PeapVersion());
     setPhase1PeapLabel(other->phase1PeapLabel());
     setPhase1FastProvisioning(other->phase1FastProvisioning());
@@ -190,21 +211,7 @@ void \
NetworkManager::Settings::Security8021xSetting::setCaCertificate(const QStr  {
     Q_D(Security8021xSetting);
 
-    QCA::ConvertResult result;
-    // http://projects.gnome.org/NetworkManager/developers/api/09/ref-settings.html#idp8706528
                
-    // says this can be a PEM or DER encoded file, but QCA only has a method for PEM \
                from a file,
-    // and i don't feel like doing file access in here myself today
-    d->caCert.cert = QCA::Certificate::fromPEMFile(caCertPath, &result);
-    if (result == QCA::ConvertGood) {
-        d->caCert.scheme = scheme;
-        if (scheme == CertKeySchemePath) {
-            d->caCert.fileName = caCertPath;
-        } else {
-            d->caCert.fileName = QString();
-        }
-    } else {
-        d->caCert.scheme = CertKeySchemeNone;
-    }
+    d->caCert.loadCert(caCertPath, scheme);
 }
 
 QByteArray NetworkManager::Settings::Security8021xSetting::caCertificateBlob() const
diff --git a/settings/802-1x_p.h b/settings/802-1x_p.h
index 6029765..9860663 100644
--- a/settings/802-1x_p.h
+++ b/settings/802-1x_p.h
@@ -46,6 +46,7 @@ public:
     CertificateWrapper();
     CertificateWrapper(const CertificateWrapper&);
     ~CertificateWrapper();
+    void loadCert(const QString & path, \
NetworkManager::Settings::Security8021xSetting::CertKeyScheme scheme);  \
NetworkManager::Settings::Security8021xSetting::CertKeyScheme scheme;  \
QCA::Certificate cert;  // QCA does not store this in Certificate


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

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