Commit 12f1c7f9c11c3f2cce55e8694bc91348e72fe507
Exists in
master
merge
Showing
9 changed files
with
120 additions
and
43 deletions
Show diff stats
cacic-teste/cacic-teste.pro
cacic-teste/cacic-teste.pro.user
... | ... | @@ -54,14 +54,14 @@ |
54 | 54 | <data> |
55 | 55 | <variable>ProjectExplorer.Project.Target.0</variable> |
56 | 56 | <valuemap type="QVariantMap"> |
57 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3.0 MinGW 32bit</value> | |
58 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3.0 MinGW 32bit</value> | |
59 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.win32_mingw482_kit</value> | |
57 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3 GCC 64bit</value> | |
58 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3 GCC 64bit</value> | |
59 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.gcc_64_kit</value> | |
60 | 60 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
61 | 61 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
62 | 62 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
63 | 63 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
64 | - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/LightBase/cacic-agente-project/builds/cacic-teste</value> | |
64 | + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/cacic-agente/builds</value> | |
65 | 65 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
66 | 66 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
67 | 67 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
... | ... | @@ -78,7 +78,10 @@ |
78 | 78 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
79 | 79 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
80 | 80 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
81 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
81 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
82 | + <value type="QString">-w</value> | |
83 | + <value type="QString">-r</value> | |
84 | + </valuelist> | |
82 | 85 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
83 | 86 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
84 | 87 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -94,7 +97,10 @@ |
94 | 97 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
95 | 98 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
96 | 99 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
97 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
100 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
101 | + <value type="QString">-w</value> | |
102 | + <value type="QString">-r</value> | |
103 | + </valuelist> | |
98 | 104 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
99 | 105 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
100 | 106 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -114,7 +120,7 @@ |
114 | 120 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
115 | 121 | </valuemap> |
116 | 122 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
117 | - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/LightBase/Cacic Agente/cacic-agente/build-cacic-teste-Desktop_Qt_5_3_0_MinGW_32bit-Release</value> | |
123 | + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/cacic-agente/build-cacic-teste-Desktop_Qt_5_3_GCC_64bit-Release</value> | |
118 | 124 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
119 | 125 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
120 | 126 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
... | ... | @@ -131,7 +137,10 @@ |
131 | 137 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
132 | 138 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
133 | 139 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
134 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
140 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
141 | + <value type="QString">-w</value> | |
142 | + <value type="QString">-r</value> | |
143 | + </valuelist> | |
135 | 144 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
136 | 145 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
137 | 146 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -147,7 +156,10 @@ |
147 | 156 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
148 | 157 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
149 | 158 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
150 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
159 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
160 | + <value type="QString">-w</value> | |
161 | + <value type="QString">-r</value> | |
162 | + </valuelist> | |
151 | 163 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
152 | 164 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
153 | 165 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -219,8 +231,8 @@ |
219 | 231 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
220 | 232 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
221 | 233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">cacic-teste</value> |
222 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">cacic-teste2</value> | |
223 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/LightBase/cacic-agente-project/cacic-agente/cacic-teste/cacic-teste.pro</value> | |
234 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
235 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lightbase/cacic-agente/cacic-teste/cacic-teste.pro</value> | |
224 | 236 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
225 | 237 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">cacic-teste.pro</value> |
226 | 238 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
... | ... | @@ -242,7 +254,7 @@ |
242 | 254 | </data> |
243 | 255 | <data> |
244 | 256 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
245 | - <value type="QByteArray">{2d43e969-a5af-4db4-9730-35c8f8cce80d}</value> | |
257 | + <value type="QByteArray">{ece4f619-8231-4029-8d3b-e5858b910820}</value> | |
246 | 258 | </data> |
247 | 259 | <data> |
248 | 260 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | ... | ... |
cacic-teste/testcacic.cpp
... | ... | @@ -72,4 +72,17 @@ void CTestCacic::testDeleteFolder() |
72 | 72 | QVERIFY(!folder.exists()); |
73 | 73 | } |
74 | 74 | |
75 | +void CTestCacic::testEnCrypt(){ | |
76 | + QString key = "qwertyuiopasdfghjklzxcvbnmqwerty"; | |
77 | + QString IV = "0123456789123456"; | |
78 | + QString input = "aqui vai a url que sera encriptada"; | |
79 | + QVERIFY(OCacic.enCrypt(input, key, IV) == "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="); | |
80 | +} | |
81 | + | |
82 | +void CTestCacic::testDeCrypt(){ | |
83 | + QString key = "qwertyuiopasdfghjklzxcvbnmqwerty"; | |
84 | + QString IV = "0123456789123456asas"; | |
85 | + QString input = "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="; | |
86 | + QVERIFY(OCacic.deCrypt(input, key, IV) == "aqui vai a url que sera encriptada"); | |
75 | 87 | |
88 | +} | ... | ... |
cacic-teste/testcacic.h
install-cacic/install-cacic.pro
... | ... | @@ -4,17 +4,16 @@ |
4 | 4 | # |
5 | 5 | #------------------------------------------------- |
6 | 6 | |
7 | -QT += core | |
7 | +QT += core | |
8 | 8 | |
9 | -QT -= gui | |
9 | +QT -= gui | |
10 | 10 | |
11 | 11 | TARGET = install-cacic |
12 | -CONFIG += console | |
13 | -CONFIG -= app_bundle | |
12 | +CONFIG += console | |
13 | +CONFIG -= app_bundle | |
14 | 14 | |
15 | 15 | TEMPLATE = app |
16 | 16 | |
17 | - | |
18 | 17 | SOURCES += main.cpp \ |
19 | 18 | installcacic.cpp \ |
20 | 19 | ../src/ccacic.cpp | ... | ... |
install-cacic/install-cacic.pro.user
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <!DOCTYPE QtCreatorProject> |
3 | -<!-- Written by QtCreator 3.1.1, 2014-07-16T17:25:19. --> | |
3 | +<!-- Written by QtCreator 3.1.2, 2014-07-17T18:11:35. --> | |
4 | 4 | <qtcreator> |
5 | 5 | <data> |
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
... | ... | @@ -54,14 +54,14 @@ |
54 | 54 | <data> |
55 | 55 | <variable>ProjectExplorer.Project.Target.0</variable> |
56 | 56 | <valuemap type="QVariantMap"> |
57 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3.0 MinGW 32bit</value> | |
58 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3.0 MinGW 32bit</value> | |
59 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.win32_mingw482_kit</value> | |
57 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.3 GCC 64bit</value> | |
58 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.3 GCC 64bit</value> | |
59 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.53.gcc_64_kit</value> | |
60 | 60 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
61 | 61 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
62 | 62 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
63 | 63 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
64 | - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/LightBase/cacic-agente-project/builds/install-cacic/</value> | |
64 | + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/cacic-agente/builds</value> | |
65 | 65 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
66 | 66 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
67 | 67 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
... | ... | @@ -78,7 +78,10 @@ |
78 | 78 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
79 | 79 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
80 | 80 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
81 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
81 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
82 | + <value type="QString">-w</value> | |
83 | + <value type="QString">-r</value> | |
84 | + </valuelist> | |
82 | 85 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
83 | 86 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
84 | 87 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -94,7 +97,10 @@ |
94 | 97 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
95 | 98 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
96 | 99 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
97 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
100 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
101 | + <value type="QString">-w</value> | |
102 | + <value type="QString">-r</value> | |
103 | + </valuelist> | |
98 | 104 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
99 | 105 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
100 | 106 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -114,7 +120,7 @@ |
114 | 120 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
115 | 121 | </valuemap> |
116 | 122 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
117 | - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/LightBase/cacic-agente-project/cacic-agente/build-install-cacic-Desktop_Qt_5_3_0_MinGW_32bit-Release</value> | |
123 | + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/lightbase/Projeto Cacic/cacic-agente/build-install-cacic-Desktop_Qt_5_3_GCC_64bit-Release</value> | |
118 | 124 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
119 | 125 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
120 | 126 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
... | ... | @@ -131,7 +137,10 @@ |
131 | 137 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
132 | 138 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
133 | 139 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
134 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
140 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
141 | + <value type="QString">-w</value> | |
142 | + <value type="QString">-r</value> | |
143 | + </valuelist> | |
135 | 144 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
136 | 145 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
137 | 146 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -147,7 +156,10 @@ |
147 | 156 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
148 | 157 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
149 | 158 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
150 | - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/> | |
159 | + <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
160 | + <value type="QString">-w</value> | |
161 | + <value type="QString">-r</value> | |
162 | + </valuelist> | |
151 | 163 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
152 | 164 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
153 | 165 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
... | ... | @@ -219,8 +231,8 @@ |
219 | 231 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
220 | 232 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
221 | 233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">install-cacic</value> |
222 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
223 | - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/LightBase/cacic-agente-project/cacic-agente/install-cacic/install-cacic.pro</value> | |
234 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">install-cacic2</value> | |
235 | + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/lightbase/cacic-agente/install-cacic/install-cacic.pro</value> | |
224 | 236 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
225 | 237 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">install-cacic.pro</value> |
226 | 238 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
... | ... | @@ -242,7 +254,7 @@ |
242 | 254 | </data> |
243 | 255 | <data> |
244 | 256 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
245 | - <value type="QByteArray">{2d43e969-a5af-4db4-9730-35c8f8cce80d}</value> | |
257 | + <value type="QByteArray">{ece4f619-8231-4029-8d3b-e5858b910820}</value> | |
246 | 258 | </data> |
247 | 259 | <data> |
248 | 260 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | ... | ... |
src/CACIC_comm.h
... | ... | @@ -71,10 +71,10 @@ public: |
71 | 71 | |
72 | 72 | if (reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).isValid()){ |
73 | 73 | retorno = reply->readAll(); |
74 | -// qDebug() << "Status:" << codigoStatus.toInt() << retorno; | |
74 | + // qDebug() << "Status:" << codigoStatus.toInt() << retorno; | |
75 | 75 | }else{ |
76 | 76 | retorno = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); |
77 | -// qDebug() << "Error:" << reason; | |
77 | + // qDebug() << "Error:" << reason; | |
78 | 78 | } |
79 | 79 | return retorno; |
80 | 80 | } |
... | ... | @@ -93,11 +93,11 @@ public: |
93 | 93 | |
94 | 94 | QString reason = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); |
95 | 95 | if (reply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).isValid()){ |
96 | - // qDebug() << "Status:" << codigoStatus.toInt() << reason; | |
96 | + // qDebug() << "Status:" << codigoStatus.toInt() << reason; | |
97 | 97 | return true; |
98 | 98 | }else{ |
99 | 99 | reason = reply->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString(); |
100 | - // qDebug() << "Error:" << reason; | |
100 | + // qDebug() << "Error:" << reason; | |
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | } | ... | ... |
src/ccacic.cpp
... | ... | @@ -22,7 +22,8 @@ QString CCacic::getValueFromFile(QString sectionName, QString keyName, QString f |
22 | 22 | int sizeKeyName = keyName.size(); |
23 | 23 | |
24 | 24 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) |
25 | - return "0"; | |
25 | + return "0"; | |
26 | + | |
26 | 27 | while (!file.atEnd()){ |
27 | 28 | line = file.readLine(); |
28 | 29 | if (line.contains(sectionName, Qt::CaseInsensitive)) { |
... | ... | @@ -101,6 +102,38 @@ bool CCacic::deleteFile(QString path) |
101 | 102 | return true; |
102 | 103 | } |
103 | 104 | |
105 | +std::string CCacic::enCrypt(QString str_in, QString key, QString iv) | |
106 | +{ | |
107 | + std::string str_out; | |
108 | + CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption encryption((byte*)key.toStdString().c_str(), key.length(), (byte*)iv.toStdString().c_str()); | |
109 | + CryptoPP::StringSource encryptor(str_in.toStdString(), true, | |
110 | + new CryptoPP::StreamTransformationFilter(encryption, | |
111 | + new CryptoPP::Base64Encoder( | |
112 | + new CryptoPP::StringSink(str_out), | |
113 | + false // do not append a newline | |
114 | + ) | |
115 | + ) | |
116 | + ); | |
117 | + qDebug(QString::fromStdString(str_out).toLocal8Bit()); | |
118 | + return str_out; | |
119 | +} | |
120 | + | |
121 | +std::string CCacic::deCrypt(QString str_in, QString key, QString iv) | |
122 | +{ | |
123 | + std::string str_out; | |
124 | + CryptoPP::CFB_Mode<CryptoPP::AES>::Decryption decryption((byte*)key.toStdString().c_str(), key.length(), (byte*)iv.toStdString().c_str()); | |
125 | + | |
126 | + CryptoPP::StringSource decryptor(str_in.toStdString(), true, | |
127 | + new CryptoPP::Base64Decoder( | |
128 | + new CryptoPP::StreamTransformationFilter(decryption, | |
129 | + new CryptoPP::StringSink(str_out) | |
130 | + ) | |
131 | + ) | |
132 | + ); | |
133 | + qDebug(QString::fromStdString(str_out).toLocal8Bit()); | |
134 | + return str_out; | |
135 | +} | |
136 | + | |
104 | 137 | /*Getters/Setters |
105 | 138 | * Begin: |
106 | 139 | */ |
... | ... | @@ -153,8 +186,3 @@ void CCacic::setChksisInfFilePath(const QString &value) |
153 | 186 | /*Getters/Setters |
154 | 187 | * End. |
155 | 188 | */ |
156 | - | |
157 | - | |
158 | - | |
159 | - | |
160 | - | ... | ... |
src/ccacic.h
1 | 1 | #ifndef CCACIC_H |
2 | 2 | #define CCACIC_H |
3 | - | |
4 | 3 | #include <QCoreApplication> |
5 | 4 | #include <QObject> |
6 | 5 | #include <QDebug> |
7 | 6 | #include <QFile> |
7 | +#include <iostream> | |
8 | +#include <iomanip> | |
9 | +#include <crypto++/aes.h> | |
10 | +#include <crypto++/base64.h> | |
11 | +#include <crypto++/modes.h> | |
12 | +#include <crypto++/filters.h> | |
13 | +#include <crypto++/hex.h> | |
14 | +#include <crypto++/sha.h> | |
15 | +#include <crypto++/md5.h> | |
8 | 16 | #include <QSettings> |
9 | 17 | #include <QDir> |
10 | 18 | #include "crypt/aes.h" |
... | ... | @@ -17,6 +25,8 @@ public: |
17 | 25 | QString getValueFromFile(QString sectionName, QString keyName, QString filePath); |
18 | 26 | void setValueToFile(QString sectionName, QString keyName, QString value, QString filePath); |
19 | 27 | QString getValueFromTags(QString fullString, QString tag, QString tagType = "[]"); |
28 | + std::string enCrypt(QString str_in, QString key, QString iv); | |
29 | + std::string deCrypt(QString str_in, QString key, QString iv); | |
20 | 30 | bool createFolder(QString path); |
21 | 31 | bool deleteFolder(QString path); |
22 | 32 | bool deleteFile(QString path); | ... | ... |