Upravy a opravování kryptování

This commit is contained in:
2024-04-11 14:31:24 +02:00
parent ead3ba6e3e
commit 3b1ee6038e
47 changed files with 414 additions and 422 deletions

View File

@@ -1,3 +1,5 @@
#ifndef EZ_APPLICATION_LICENCE_DISABLE
#define LINUX 1
// #define WINDOWS 1
@@ -10,9 +12,10 @@
int main()
{
// buffer,850client,104client, 104server, web
// kouknout na unikatní klíc pro linux
// kouknout na unikatní klíc pro linux (native uid, i openssl neco má)
try
{
InitStructure initStructure = {};
initStructure.licenceType = (int)LicenceType::DRT;
initStructure.licenceVersion = 1;
@@ -22,7 +25,7 @@ int main()
// pro ELC 1 LicenceELC1Info je to isValid, pro ELC 2 strukura { int protocolId = -1; int dataPointsCount = 0; }
initStructure.cid_csd_filePath = ""; // cesta k cidu/csd pro načtení a kontrolu licence
// verze původní ELC 1
// // verze původní ELC 1
// LicenceReader licenceReaderELC1{};
// if (licenceReaderELC1.initread(1, initStructure)) // iniciacni nacteni
// {
@@ -42,7 +45,10 @@ int main()
// cout << "CHYBA: " << licenceReaderELC1.error.message;
// }
//TODO přidat udaje o SD, kompatibilita, čas, jmeno licenčního souboru
// return SUCCES;
// TODO přidat udaje o SD, kompatibilita, čas, jmeno licenčního souboru
// pročistit private/public
// verze ELC 2 pro jeden protokol
LicenceReader licenceReaderELC2{};
@@ -54,11 +60,15 @@ int main()
LicenceELC2Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
// if ()
int protocolId = 2;
//ukayka dat SD karty
// ukayka dat SD karty
cout << "SD přečteno: " << licenceReaderELC2.sdCardInfo.isLoaded << "\n";
cout << "Card size: " << licenceReaderELC2.sdCardInfo.cardSize << "\n";
cout << "serial: " << licenceReaderELC2.sdCardInfo.serialNumber << "\n";
cout << "date: " << licenceReaderELC2.sdCardInfo.date << "\n";
cout << "name: " << licenceReaderELC2.sdCardInfo.name << "\n";
cout << "oemID: " << licenceReaderELC2.sdCardInfo.oemID << "\n";
cout << "licenceFileName: " << licenceReaderELC2.sdCardInfo.licenceFileName << "\n";
// if (initStructure.compatibility == 1) //ukazka kompatibilita 1
// {
// LicenceELC2Item_1 info; //jiná struktura, zbytek stejný
@@ -69,7 +79,7 @@ int main()
//...........
// }
//TODO toto upravit, kdyz nic neexistuje, tak to vrátí false
// TODO toto upravit, kdyz nic neexistuje, tak to vrátí false
if (licenceReaderELC2.getLicenceItemInfo(protocolId, &info))
{
cout << "Pocet licencních bodu pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
@@ -116,36 +126,12 @@ int main()
{
cout << "Obecna chyba\n";
}
// } ] } licC hLenght2 cSize2 ser number 4
//125-93-125-1 - 1 - 0 - 1 - 6 - 163 - 1 - 231 - 59 - 197 -3 - 216 - 90 -1 -0 -0 -0 -255-255-255-255
//
//125-93-125-1 - 1 - 0 - 1 - 6 - 163 - 1 - 231 - 59 - 197 -3 - 216 - 90 -1 -0 -236 -0 -255-255-255-255
//here ŹVżz5Ž;k+3f‰"Ş•ů[ 125-93-125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-0-0-255-255-255-255-0
//125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-236-0-255-255-255-255-0
string gV = "69-76-67-50-95-1-1-0-1-6-163-1-231-59-197-3-216-90-123-34-118-101-114-115-105-111-110-34-58-49-46-49-46-49-34-44-34-112-114-111-106-101-99-116-34-58-34-90-100-101-110-100-97-32-84-101-115-116-32-67-82-67-49-34-44-34-100-97-116-101-34-58-34-52-46-52-46-50-48-50-52-34-44-34-110-111-116-101-34-58-34-112-111-122-110-195-161-109-107-97-34-44-34-108-105-99-101-110-99-101-84-121-112-101-34-58-34-68-82-84-48-34-44-34-105-116-101-109-115-34-58-91-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-98-117-102-102-101-114-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-54-49-56-53-48-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-55-55-55-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-53-53-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-54-54-54-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-119-101-98-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-110-116-101-114-72-87-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-51-34-125-93-125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-7-0-0-0-9-3-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-5-0-0-0-43-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-6-0-0-0-154-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-2-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-0-0-0-0-3-0-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-186-165";
string bV = "69-76-67-50-95-1-1-0-1-6-163-1-231-59-197-3-216-90-123-34-118-101-114-115-105-111-110-34-58-49-46-49-46-49-34-44-34-112-114-111-106-101-99-116-34-58-34-90-100-101-110-100-97-32-84-101-115-116-32-67-82-67-49-34-44-34-100-97-116-101-34-58-34-52-46-52-46-50-48-50-52-34-44-34-110-111-116-101-34-58-34-112-111-122-110-195-161-109-107-97-34-44-34-108-105-99-101-110-99-101-84-121-112-101-34-58-34-68-82-84-48-34-44-34-105-116-101-109-115-34-58-91-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-98-117-102-102-101-114-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-54-49-56-53-48-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-55-55-55-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-99-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-53-53-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-101-99-49-48-52-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-54-54-54-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-119-101-98-115-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-52-50-57-52-57-54-55-50-57-53-34-125-44-123-34-110-97-109-101-34-58-34-112-116-95-69-122-95-105-110-116-101-114-72-87-34-44-34-100-97-116-97-80-111-105-110-116-115-67-111-117-110-116-34-58-34-51-34-125-93-125-1-1-0-1-6-163-1-231-59-197-3-216-90-1-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-7-0-0-0-9-3-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-5-0-0-0-43-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-6-0-0-0-154-2-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-2-0-0-0-255-255-255-255-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-0-0-0-0-3-0-0-0-0-1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31-32-33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53-54-55-56-57-58-59-60-61-62-63-186-165";
// std::vector<string> gTokens;
// std::vector<string> bTokens;
// std::stringstream ssG(gV);
// std::stringstream ssB(bV);
// std::string token;
// while (getline(ssG, token, '-')) { gTokens.push_back(token); }
// while (getline(ssB, token, '-')) { bTokens.push_back(token); }
// cout << gTokens.size() << "\n";
// cout << bTokens.size() << "\n";
cout << (gV == bV) << "\n";
return SUCCES;
}
// buffer,web, 850client,104client, 104server,
//
/*
pt_Ez_interHW, // 0 - interni virtualni typ pro urceni licence na dany HW
pt_Ez_buffer, // 1 - datovy Buffer
@@ -187,7 +173,7 @@ pt_Ez_mbusm, // 36 - MBus master
pt_Ez_azddakm, // 37 - AZD DAK master
pt_Ez_rwaytechc, // 38 - RwayTech client (modbus IP)
pt_Ez_weinteksl, // 39 - Weintek touch screen server/slave (modbus protokol)
Pro index 0 (pt_Ez_interHW) jsou možné hodnoty (počet licenčních bodů):
@@ -244,3 +230,5 @@ pt_Ez_azddakm, // 37 - AZD DAK master
pt_Ez_rwaytechc, // 38 - RwayTech client (modbus IP)
pt_Ez_weinteksl, // 39 - Weintek touch screen server/slave (modbus protokol)
*/
#endif