Commit 70143f745684369bca4f4873ea3e812898f1966e
1 parent
0036857c
Exists in
master
documentação em comentarios
Showing
2 changed files
with
6 additions
and
6 deletions
Show diff stats
cacic-teste/testcacic.cpp
@@ -68,15 +68,15 @@ void CTestCacic::testDeleteFolder() | @@ -68,15 +68,15 @@ void CTestCacic::testDeleteFolder() | ||
68 | } | 68 | } |
69 | 69 | ||
70 | void CTestCacic::testEnCrypt(){ | 70 | void CTestCacic::testEnCrypt(){ |
71 | - QString key = "qwertyuiopasdfghjklzxcvbnmqwerty"; | ||
72 | - QString IV = "0123456789123456"; | 71 | + QString key = "qwertyuiopasdfghjklzxcvbnmqwerty"; //chave de 256 bits (32 caracteres) |
72 | + QString IV = "0123456789123456"; //iv nunca se repete para a mesma senha. | ||
73 | QString input = "aqui vai a url que sera encriptada"; | 73 | QString input = "aqui vai a url que sera encriptada"; |
74 | QVERIFY(OCacic.enCrypt(input, key, IV) == "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="); | 74 | QVERIFY(OCacic.enCrypt(input, key, IV) == "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="); |
75 | } | 75 | } |
76 | 76 | ||
77 | void CTestCacic::testDeCrypt(){ | 77 | void CTestCacic::testDeCrypt(){ |
78 | - QString key = "qwertyuiopasdfghjklzxcvbnmqwerty"; | ||
79 | - QString IV = "0123456789123456asas"; | 78 | + QString key = "qwertyuiopasdfghjklzxcvbnmqwerty"; //chave de 256 bits (32 caracteres) |
79 | + QString IV = "0123456789123456asas"; //iv nunca se repete para a mesma senha. | ||
80 | QString input = "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="; | 80 | QString input = "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="; |
81 | QVERIFY(OCacic.deCrypt(input, key, IV) == "aqui vai a url que sera encriptada"); | 81 | QVERIFY(OCacic.deCrypt(input, key, IV) == "aqui vai a url que sera encriptada"); |
82 | 82 |
src/ccacic.h
@@ -24,8 +24,8 @@ public: | @@ -24,8 +24,8 @@ public: | ||
24 | QString getValueFromFile(QString sectionName, QString keyName, QString filePath); | 24 | QString getValueFromFile(QString sectionName, QString keyName, QString filePath); |
25 | void setValueToFile(QString sectionName, QString keyName, QString value, QString filePath); | 25 | void setValueToFile(QString sectionName, QString keyName, QString value, QString filePath); |
26 | QString getValueFromTags(QString fullString, QString tag, QString tagType = "[]"); | 26 | QString getValueFromTags(QString fullString, QString tag, QString tagType = "[]"); |
27 | - std::string enCrypt(QString str_in, QString key, QString iv); | ||
28 | - std::string deCrypt(QString str_in, QString key, QString iv); | 27 | + QString enCrypt(QString str_in, QString key, QString iv); |
28 | + QString deCrypt(QString str_in, QString key, QString iv); | ||
29 | bool createFolder(QString path); | 29 | bool createFolder(QString path); |
30 | bool deleteFolder(QString path); | 30 | bool deleteFolder(QString path); |
31 | bool deleteFile(QString path); | 31 | bool deleteFile(QString path); |