summaryrefslogtreecommitdiffstats
path: root/pica-client/skynet.cpp
diff options
context:
space:
mode:
authorme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2012-07-22 12:00:06 +0000
committerme_desk <me_desk@fb96df88-216d-11de-830c-f3023f12d8ac>2012-07-22 12:00:06 +0000
commitc7323aafac1769cb809da3f1d7ddd05383ace641 (patch)
treeddd736fbbe600d6eacc1f324d98a3c3064244b89 /pica-client/skynet.cpp
parentf190872a4ab94577d1d9db343c0ca7643f40eae6 (diff)
downloadpica-pica-c7323aafac1769cb809da3f1d7ddd05383ace641.tar.gz
pica-pica-c7323aafac1769cb809da3f1d7ddd05383ace641.zip
1) Automatic account registration implemented;
2) All openssl command line tools invocations moved to new class OpenSSLTool git-svn-id: svn://localhost/project_picapica/trunk@150 fb96df88-216d-11de-830c-f3023f12d8ac
Diffstat (limited to 'pica-client/skynet.cpp')
-rw-r--r--pica-client/skynet.cpp25
1 files changed, 2 insertions, 23 deletions
diff --git a/pica-client/skynet.cpp b/pica-client/skynet.cpp
index 0d2ad08..44f0101 100644
--- a/pica-client/skynet.cpp
+++ b/pica-client/skynet.cpp
@@ -3,6 +3,7 @@
#include <QMutex>
//#include "dialogs/viewcertdialog.h"
#include "contacts.h"
+#include "openssltool.h"
//#include <QMessageBox> //debug
//#include "dialogs/forgedcertdialog.h"
#include <QDebug>
@@ -98,30 +99,8 @@ void SkyNet::verify_peer_cert(quint32 peer_id, QString cert_pem, bool *verified)
{
cnt.SetContactCert(peer_id, cert_pem);
- // -- move to OpenSSL class
- QProcess openssl;
+ QString name = OpenSSLTool::NameFromCertString(cert_pem);
- openssl.start("openssl",QStringList()<<"x509"<<"-subject"<<"-nameopt"<<"oneline,-esc_msb,utf8"<<"-noout");
- if (!openssl.waitForStarted())
- return;
-
- openssl.write(cert_pem.toAscii());
-
- if (!openssl.waitForFinished())
- return;
-
- QByteArray result = openssl.readAll();
- QRegExp rx("CN = [0-9]+\\#([^\\s\\#]+)");
-
-
- QString name=QString::fromUtf8( result.constData());
-
- if (name.contains(rx))
- {
- name=rx.cap(1);
- }
-
- //
cnt.SetContactName(peer_id, name);
}
else