čištění a další upravy

This commit is contained in:
2023-12-08 10:30:44 +01:00
parent f92b2c708f
commit 892ae13bf2
26 changed files with 294 additions and 72 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
chmod 777 output/licenceGenerator
#./output/licenceGenerator -cid=9f5449534443495461457815de0164a9 -csd=400e00325b5900003be77f800a400043 -outputType=file -configFileName=licData.xml -licenceFileName=ezlic_eovosv0_vaxvcpalxjx.lic -licenceVersion=1 -licenceType=EOV_OSV
#./output/licenceGenerator -cid=0353445355313647801b1a9f6600c747 -csd=400e00325b59000076b27f800a404013 -outputType=file -configFileName=licData.xml -licenceFileName=ezlic_eovosv0_vaxvcpalxjx.lic -licenceVersion=1 -licenceType=EOV_OSV
cd output
./licenceGenerator -cid=9f5449534443495461457815de0164a9 -csd=400e00325b5900003be77f800a400043 -outputType=file -configFileName=licData.xml -licenceFileName=ezlic_eovosv0_vaxvcpalxjx.lic -licenceVersion=1 -licenceType=EOV_OSV
./licenceGenerator -cid=0353445355313647801b1a9f6600c747 -csd=400e00325b59000076b27f800a404013 -outputType=file -configFileName=licData.xml -licenceFileName=ezlic_eovosv0_vaxvcpalxjx.lic -licenceVersion=1 -licenceType=EOV_OSV

View File

@@ -106,6 +106,10 @@ struct LicenceIdentification
uint8_t licCompatibility = 1; // identikator hlavního ELC
uint16_t licItemsCount = 0;
string cid_cds_path = "";
string licenceFilePath = "";
};
struct LicData
@@ -165,17 +169,14 @@ struct LicenceInfo11
class LicenceException : public std::exception
{
public:
// Constructor with int and string parameters
LicenceException(int errorCode, const std::string &errorMessage)
: errorCode_(errorCode), errorMessage_(errorMessage) {}
// Override the what() function to provide a description of the exception
const char *what() const noexcept override
{
return errorMessage_.c_str();
}
// Getter functions for the exception members
int getErrorCode() const
{
return errorCode_;

View File

@@ -230,8 +230,7 @@ class LicenceELC11
private:
SDCard sdCard;
const string cid_cdsPath = ""; //"c:\\_projects\\LicenceGenerator\\output\\"; ///sys/block/mmcblk0/device/
const string licenceFilePath = ""; //"c:\\_projects\\LicenceGenerator\\output\\";
string cidString = "";
char cid[32] = {};
string csdString = "";
@@ -266,6 +265,8 @@ public:
string operationErrors = "";
ErrorMessage errorMessage;
string cid_cdsPath = ""; //"c:\\_projects\\LicenceGenerator\\output\\"; ///sys/block/mmcblk0/device/
string licenceFilePath = ""; //"c:\\_projects\\LicenceGenerator\\output\\";
LicenceELC11();
~LicenceELC11();

View File

@@ -13,8 +13,7 @@ using namespace std;
class LicenceELC21
{
const string cid_cdsPath = ""; //"c:\\_projects\\LicenceGenerator\\output\\"; ///sys/block/mmcblk0/device/
const string licenceFilePath = ""; //"c:\\_projects\\LicenceGenerator\\output\\";
enum class Error21
{
@@ -88,6 +87,7 @@ class LicenceELC21
};
private:
int licItemCount = 0;
LicenceBody licBody;
LicenceIdentification lIdentification;
@@ -107,6 +107,8 @@ class LicenceELC21
ErrorMessage errorMessage;
LicenceInfo21 licenceInfo;
string cid_cdsPath = ""; //"c:\\_projects\\LicenceGenerator\\output\\"; ///sys/block/mmcblk0/device/
string licenceFilePath = ""; //"c:\\_projects\\LicenceGenerator\\output\\";
LicenceELC21();
~LicenceELC21();

View File

@@ -26,13 +26,12 @@ using namespace std;
int licenceIndex = 0;
int compatibility = 0;
string licenceFilePath = "";
string cid_csd_filePath = "";
};
class LicenceGenerator
{
public:
int elcSwitchType;
string operationErrors = "";

32
licData.xml Normal file
View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<licence elc="1" xmlVersion="1" revision="1" compatibility="1">
<licenceType licenceVersion="1" licenceIndex="0">EOV_OSV</licenceType>
<plcType>WAGO</plcType>
<licenceName>Licence pro EOV_OSV</licenceName>
<station>start.cz</station>
<distributor>teco</distributor>
<project>Projekt XXX stanice YYY</project>
<items>
<item>
<name>Položka licence 1</name>
<protoId>666</protoId>
<dataPointsCount>100</dataPointsCount>
</item>
<item>
<name>Položka licence 2</name>
<protoId>777</protoId>
<dataPointsCount>200</dataPointsCount>
</item>
<item>
<name>Položka licence 3</name>
<protoId>888</protoId>
<dataPointsCount>300</dataPointsCount>
</item>
<item>
<name>Položka licence 3</name>
<protoId>999</protoId>
<dataPointsCount>1600</dataPointsCount>
</item>
</items>
</licence>

View File

@@ -4,5 +4,5 @@
<licenceType version="1">EOV_OSV</licenceType>
<licenceName>Licence pro EOV_OSV</licenceName>
<station>start.cz</station>
<distributor>wago</distributor>
<distributor>teco</distributor>
</data>

View File

@@ -1,4 +1,4 @@
9f5449534443495461457815de0164a9
0353445355313647801b1a9f6600c747
6   . x4 <20><><EFBFBD>  .. nt$6 &<26> manfid 6 <20><><EFBFBD>
 cid "6 <10> fwrev 6 Jm<4A>  csd ,6 gEd$
subsystem 46 <20><><EFBFBD>%

View File

@@ -1,2 +1,2 @@
400e00325b5900003a0d7f800a40008d
400e00325b59000076b27f800a404013

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -3,8 +3,8 @@
<licenceType licenceVersion="1" licenceIndex="0">EOV_OSV</licenceType>
<plcType>WAGO</plcType>
<licenceName>Licence pro EOV_OSV</licenceName>
<station>start.cz</station>
<distributor>wago</distributor>
<station>eov.ceskatrebova.ddts.cz</station>
<distributor>eov2</distributor>
<project>Projekt XXX stanice YYY</project>
<items>
<item>

Binary file not shown.

View File

@@ -1,29 +1,69 @@
#include <stdio.h>
#include "plcLicence.h"
#include "utils.h"
#include <filesystem>
#define FILEBUFFER 300
#define TWO_HOURSE_SECONDS 7200
#include "licenceGenerator.h"
#include "licenceCommon.h"
/// @brief hlavní funkce
/// @param argc
/// @param argv parametry pro generování licence
/// 1-cid, 2-csd, 3-stanice 4-rozvadec 5-typ licence
/// @return
int main5(int argc, char *argv[])
int main(int argc, char *argv[])
{
unordered_map<string, string> arguments = getArguments(argc, argv);
LicenceGenerator generatorOld = LicenceGenerator(arguments["-uid"], arguments["-cid"], arguments["-csd"], arguments["-configFileName"]);
generatorOld.createLicenceFile();
return SUCCES;
LicenceGenerator licenceGenerator = LicenceGenerator();
PlcLicence plcWriteLicence = PlcLicence(arguments["-cid"], arguments["-csd"], arguments["-outputType"], arguments["-configFileName"]);
if (plcWriteLicence.CreateLicence() == false)
InitStructure initStructure;
initStructure.elcType = 2;
initStructure.licenceType = (int)LicenceType::EOS_EOV;
initStructure.licenceVersion = 1;
initStructure.licenceIndex = 0;
initStructure.compatibility = 1;
initStructure.licenceFilePath = "";
initStructure.cid_csd_filePath = "";
// //verze #1: načtení kompletní licence a zobrazení
// if (licenceGenerator.init(initStructure))
// {
// LicenceInfo21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
// int protocolId = 345;
// if (licenceGenerator.getLicenceInfo(protocolId, &info))
// {
// std::cout << "Počet licenčních bodů pro : " << protocolId << ": " << info.reqDataPointsCount << std::endl;
// if (info.licences.count(protocolId) > 0) cout << "počet z vectoru pro : " << protocolId << info.licences.at(888) << endl;
// cout << "všechny licenční body: " << endl;
// for (const auto &pair : info.licences) { std::cout << "<" << pair.first << ", " << pair.second << ">" << endl; }
// }
// else
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
// }
// else
// {
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
// }
//verze #2 : iterace pro kazdý bod zvlášť
if (licenceGenerator.initread(initStructure))
{
cerr << "Licence creation failed";
int protocolId = 888;
LicenceItem21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
if (licenceGenerator.getLicenceItemInfo(protocolId, &info))
{
std::cout << "Počet licenčních bodů pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
}
else
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
}
else
{
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
}
return EXIT_SUCCESS;
system("pause");
return SUCCES;
}

View File

@@ -395,7 +395,7 @@ bool LicenceELC11::createEosEovLicence()
else
{
dataToFile.header.licCount = 1;
dataToFile.items[1].licCount = 999;//65535;
dataToFile.items[1].licCount = 65535; // 65535;
dataToFile.items[1].protoId = cEzLic_p78ou3_CheckLicNumberId_EOV1;
dataToFile.items[1].data1 = cEzLic_p78ou3_CheckLicNumber_EOV1;
}
@@ -680,6 +680,9 @@ bool LicenceELC11::readLicence(LicenceInfoGeneral *licences)
fileNameCh[i] = licFilePath[i];
licenceFile = fopen(fileNameCh, "rb"); // read mode
if (licenceFile == nullptr) throw LicenceException((int)Error11::LicenceReadError, "Licence read error: " + licFilePath);
fseek(licenceFile, 0, SEEK_END); // seek to end of file
const int size = ftell(licenceFile); // get current file pointer
fseek(licenceFile, 0, SEEK_SET);
@@ -728,10 +731,10 @@ bool LicenceELC11::readLicence(LicenceInfoGeneral *licences)
// CryptData cryptData = initCrypto(sdData, licIdent.licIDType);
unsigned char decrypted[2000] = {};
int decrypted_len = decrypt(encryptedData, sizeof(encryptedData), cryptData.aesKey, cryptData.aesInitVector, decrypted);
#ifdef DEB
#ifdef DEB
cout << "sizeof(licEncryptedData: " << sizeof(licEncryptedData) << endl;
cout << "decrypted_len: " << decrypted_len << endl;
#endif
#endif
if (sizeof(licEncryptedData) != decrypted_len)
{

View File

@@ -92,6 +92,8 @@ bool LicenceGenerator::initread(InitStructure &initStructure)
case 11:
{ // old eoseov
LicenceELC11 licence = LicenceELC11(this->licIdentification);
licence.cid_cdsPath = initStructure.cid_csd_filePath;
licence.licenceFilePath = initStructure.licenceFilePath;;
licence.readLicence(&this->licenceInfo);
break;
}
@@ -99,6 +101,8 @@ bool LicenceGenerator::initread(InitStructure &initStructure)
{
LicenceELC21 licence = LicenceELC21(this->licIdentification);
this->licence21 = &licence;
licence.cid_cdsPath = initStructure.cid_csd_filePath;
licence.licenceFilePath = initStructure.licenceFilePath;;
this->licence21->readLicence(&this->licenceInfo);
break;
}

View File

@@ -1,20 +1,27 @@
#define NEW =1
#ifdef NEW
#include <stdio.h>
#include "utils.h"
#include "licenceGenerator.h"
#include "licenceCommon.h"
#define FILEBUFFER 300
#define TWO_HOURSE_SECONDS 7200
/// @brief hlavní funkce
/// @param argc
/// @param argv parametry pro generování licence
/// @return
int main(int argc, char *argv[])
int main5(int argc, char *argv[])
{
// cout << "test" << endl;
// unordered_map<string, string> arguments = getArguments(argc, argv);
// LicenceGenerator generatorOld = LicenceGenerator(arguments["-uid"], arguments["-cid"], arguments["-csd"], arguments["-configFileName"]);
// generatorOld.createLicenceFile();
// return 0;
//cout << "Reading Test" << endl;
cout << "test" << endl;
unordered_map<string, string> arguments = getArguments(argc, argv);
LicenceGenerator generatorOld = LicenceGenerator(arguments["-uid"], arguments["-cid"], arguments["-csd"], arguments["-configFileName"]);
generatorOld.createLicenceFile();
return 0;
LicenceGenerator licenceGenerator = LicenceGenerator();
InitStructure initStructure;
@@ -23,21 +30,20 @@ int main(int argc, char *argv[])
initStructure.licenceVersion = 1;
initStructure.licenceIndex = 0;
initStructure.compatibility = 1;
initStructure.licenceFilePath = "";
initStructure.licenceFilePath = "test";
initStructure.cid_csd_filePath = "test";
// if (licenceGenerator.init(initStructure))
// {
// LicenceInfo21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
// if (licenceGenerator.getLicenceInfo(888, &info))
// {
// std::cout << "Počet licenčních bodů pro 888: " << info.reqDataPointsCount << std::endl;
// if (info.licences.count(888) > 0) cout << "počet z vectoru pro 888: " << info.licences.at(888) << endl;
// if (info.licences.count(888) > 0)
// cout << "počet z vectoru pro 888: " << info.licences.at(888) << endl;
// cout << "všechny licenční body: " << endl;
// for (const auto& pair : info.licences) { std::cout << "<" << pair.first << ", " << pair.second << ">" << endl;
// }
// //for (const auto &pair : info.licences) { std::cout << "<" << pair.first << ", " << pair.second << ">" << endl; }
// }
// else
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
@@ -46,24 +52,56 @@ int main(int argc, char *argv[])
// {
// cerr << "Došlo k chybě: " << licenceGenerator.error.message;
// }
if (licenceGenerator.initread(initStructure))
{
LicenceItem21 info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
if (licenceGenerator.getLicenceItemInfo(777, &info))
{
std::cout << "Počet licenčních bodů pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
//for (const auto& pair : info.licences) { std::cout << "<" << pair.first << ", " << pair.second << ">" << endl;
// for (const auto& pair : info.licences) { std::cout << "<" << pair.first << ", " << pair.second << ">" << endl;
}
else cerr << "Došlo k chybě: " << licenceGenerator.error.message;
else
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
}
else
{
cerr << "Došlo k chybě: " << licenceGenerator.error.message;
}
system("pause");
return EXIT_SUCCESS;
return 0;
}
#endif
#ifndef NEW
#include <stdio.h>
#include "utils.h"
#include "plcLicence.h"
// #include "licenceGenerator.h"
// #include "licenceCommon.h"
#define FILEBUFFER 300
#define TWO_HOURSE_SECONDS 7200
/// @brief hlavní funkce
/// @param argc
/// @param argv parametry pro generování licence
/// @return
int main(int argc, char *argv[])
{
unordered_map<string, string> arguments = getArguments(argc, argv);
PlcLicence plcWriteLicence = PlcLicence(arguments["-cid"], arguments["-csd"], arguments["-outputType"], arguments["-configFileName"]);
if (plcWriteLicence.CreateLicence() == false)
{
cerr << "Licence creation failed";
}
// cout << "Reading Test" << endl;
system("pause");
return 0;
}
#endif

View File

@@ -330,6 +330,8 @@ bool PlcLicence::CreateEosEovLicence()
dataToFile.id.version = 10;
dataToFile.id.cardSize = this->sdData.cardSize;
cout << "cardSize: " << this->sdData.cardSize << endl;
switch (licIdent.licIDType)
{
case cEzLic_p78ou3_IDType_DDTS:
@@ -348,6 +350,9 @@ bool PlcLicence::CreateEosEovLicence()
dataToFile.header.licVersion = 10;
dataToFile.header.licType = licIdent.licIDType;
dataToFile.header.licDate = getLicDate(); // 1692230400; //getLicDate(); //1692144000;// getLicDate();
cout << "date:" << dataToFile.header.licDate << endl;
mainLicDescription += dataToFile.header.licDescription1;
mainLicDescription += " [";
mainLicDescription += dataToFile.header.licDescription2;
@@ -380,6 +385,10 @@ bool PlcLicence::CreateEosEovLicence()
memcpy(byteArray, &dataToFile, sizeof(dataToFile));
cout << endl;
for (auto x : byteArray) cout << (int)x << "-";
cout << endl;
int finalEncryptedLength = encrypt(byteArray, sizeof(dataToFile), this->cryptData.aesKey, this->cryptData.aesInitVector, encrypted);
if (licIdent.licPrefixType == cEzLic_p78ou3_LicPrefixType_ELC1) // typ1 = pouze zasifrovani dat

View File

@@ -115,6 +115,8 @@ bool LicenceELC21::createLicence()
privateContent.push_back(crcComplete & 0xFF);
privateContent.push_back((crcComplete >> 8) & 0xFF);
privateContentEncrypted = cryptPrivateContent(privateContent);
#ifdef DEB
@@ -162,22 +164,19 @@ bool LicenceELC21::createLicence()
bool LicenceELC21::readLicence(LicenceInfoGeneral * licences)
{
try
{
// sdCard = SDCard("9f544930303030300000000b47015423", "400e00325b5900003a0d7f800a40008d");
sdCard = SDCard(this->cid_cdsPath);
if (sdCard.isLoaded == false)
throw LicenceException((int)Error21::SDCardReadError, "Chyba při čtení SD karty, cesta: " + cid_cdsPath);
if (sdCard.isLoaded == false) throw LicenceException((int)Error21::SDCardReadError, "Chyba při čtení SD karty, cesta: " + cid_cdsPath);
string licFileName = getLicenceName();
string licFilePath = this->licenceFilePath+licFileName;
// Create an unsigned char vector to store the file data
vector<char> content;
if (readFile(licFilePath, content) == false)
{
throw LicenceException((int)GeneralError::FileOpenError, "Chyba otevření souboru licence.");
throw LicenceException((int)GeneralError::FileOpenError, "Chyba otevření souboru licence: " + licFilePath);
}
this->licBody.licId.licIdent[0] = content[0];
@@ -266,15 +265,6 @@ bool LicenceELC21::readLicence(LicenceInfoGeneral * licences)
this->licenceInfo.licences.insert(pair<int, int>(item.protoId, item.licCount));
licences->licences.insert(pair<int, int>(item.protoId, item.licCount));
}
}
catch (const LicenceException &ex)
{
errorMessage.code = ex.getErrorCode();
errorMessage.message = ex.getErrorMessage();
return false;
}
return true;
}

View File

@@ -1,3 +1,105 @@
10
-0
-0
-0
-79
-58
-0
-0
-2
-0
-10
-0
-128
-92
-114
-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-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-37-59-
<?xml version="1.0" encoding="UTF-8" ?>
<data version="1">
<plcType>WAGO</type>

View File

@@ -960,8 +960,8 @@ string readFileToString(const std::string &filename, std::size_t sizeS)
bool readFile(string fileName, vector<char> &output)
{
std::ifstream file(fileName, std::ios::in | std::ios::binary);
if (!file.is_open())
if (file.is_open() != 1)
{
return false;
}
@@ -973,6 +973,7 @@ bool readFile(string fileName, vector<char> &output)
output.push_back(byte);
}
file.close();
// Get the size of the file
// file.seekg(0, std::ios::end);