This commit is contained in:
2024-05-16 09:25:25 +02:00
parent ca93b3369f
commit d03261b873
13 changed files with 23 additions and 24 deletions

View File

@@ -8,7 +8,7 @@ CXX = g++
# define any compile-time flags
# CXXFLAGS := -std=c++17 -Wall -Wextra -g -lssl -lcrypto -w
CXXFLAGS := -Wall -Wextra -g -lssl -lcrypto
CXXFLAGS := -Wall -Wextra -g -lssl -lcrypto -std=c++11
# define library paths in addition to /usr/lib
# if I wanted to include libraries not in /usr/lib I'd specify
@@ -16,10 +16,10 @@ CXXFLAGS := -Wall -Wextra -g -lssl -lcrypto
LFLAGS =
# define output directory
OUTPUT := output
OUTPUT:= output
# define source directory
SRC := src src/common src/reader src/generator
SRC := src src/common src/reader src/generator
# define include directory
INCLUDE := include include/common include/reader include/generator

View File

@@ -8,7 +8,7 @@ CXX = g++
# define any compile-time flags
# CXXFLAGS := -std=c++17 -Wall -Wextra -g -lssl -lcrypto
CXXFLAGS := -Wall -Wextra -g -lssl -lcrypto -std=c++11
CXXFLAGS := -Wall -Wextra -g -lssl -lcrypto -w -std=c++11
# define library paths in addition to /usr/lib
# if I wanted to include libraries not in /usr/lib I'd specify

View File

@@ -1 +1 @@
licenceGenerator.exe -uid=9a2314bcee131834715adcabc506724c -cid=9f54495344434954615ad803c50171bf -csd=400e00325b5900003be77f800a400043 -outputType=file -configFileName=licData.xml
licenceGenerator.exe -uid=a3395d1b898b4fdbbd563f9c75b3e885.a433 -cid=9f54495344434954615ad803c50171bf -csd=400e00325b5900003be77f800a400043 -outputType=file -configFileName=licData.xml

View File

@@ -3,7 +3,7 @@
<licenceType licenceVersion="1" licenceIndex="0">DRT</licenceType>
<plcType>wago</plcType>
<licenceName>Licence pro EOV_OSV</licenceName>
<project>Zdenda Test CRC4</project>
<project>Licence ELC3</project>
<items>
<item>
<name>pt_Ez_interHW</name>
@@ -33,7 +33,7 @@
<item>
<name>pt_Ez_iec61850c</name>
<protoId>7</protoId>
<dataPointsCount>30777</dataPointsCount>
<dataPointsCount>77</dataPointsCount>
</item>
</items>
</licence>

View File

@@ -1 +1 @@
9a2314bcee131834715adcabc506724c
a3395d1b898b4fdbbd563f9c75b3e885

View File

@@ -1,6 +1,6 @@
#ifndef EZ_APPLICATION_LICENCE_DISABLE
// #define LINUX 1
#define WINDOWS 1
#define LINUX 1
//#define WINDOWS 1
#define READ 1
#include <stdio.h>
@@ -11,7 +11,7 @@
/// @param argc
/// @param argv parametry pro generování licence
/// @return
int main(int argc, char *argv[])
int main8(int argc, char *argv[])
{
unordered_map<string, string> arguments = getArguments(argc, argv);
try

View File

@@ -1,7 +1,7 @@
#ifndef EZ_APPLICATION_LICENCE_DISABLE
//#define LINUX 1
#define WINDOWS 1
#define LINUX 1
//#define WINDOWS 1
#include "licenceReader.h"
@@ -9,7 +9,7 @@
/// @param argc
/// @param argv parametry pro generování licence
/// @return
int main8()
int main()
{
// buffer,850client,104client, 104server, web
// kouknout na unikatní klíc pro linux (native uid, i openssl neco má)
@@ -32,11 +32,9 @@ int main8()
LicenceReader licenceReaderELC3{};
if (licenceReaderELC3.initread(3, initStructure)) // iniciacni nacteni
{
LicenceELC3Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo11, LicenceInfo21, LicenceInfo31)
LicenceELC3Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo1, LicenceInfo2, LicenceInfo3)
// if ()
int protocolId = 4;
cout << "název licenčního souboru: " << licenceReaderELC3.licInfo.licenceFileName << "\n";
cout << "cesta k licenčnímu souboru: " << licenceReaderELC3.licInfo.licenceFilePath << "\n";
if (licenceReaderELC3.getLicenceItemInfo(protocolId, &info))
{

View File

@@ -110,7 +110,7 @@ vector<unsigned char> LicenceELC3::decryptPrivateContent(const std::vector<unsig
void LicenceELC3::initVector(BYTE *iVector, BYTE *key)
{
BYTE uidb[32] = {};
BYTE uidb[UID_LENGTH] = {};
for (unsigned int i = 0; i < this->uid.length(); i++) uidb[i] = uid[i];
CryptInitVector vec1 = {uidb[10],

View File

@@ -1,6 +1,7 @@
#ifndef EZ_APPLICATION_LICENCE_DISABLE
#define WINDOWS 1
//#define WINDOWS 1
#define LINUX 1
#include <openssl/conf.h>
#include <openssl/ssl.h> /* core library */

View File

@@ -20,7 +20,7 @@ LicenceGenerator::LicenceGenerator(string uid, string cid, string csd, string da
if (uid.empty() == false)
{
if (uid.length() != 32) throw LicenceException((int)GeneralError::IvanlidParam, "UID incorrect size");
if (uid.length() < 32) throw LicenceException((int)GeneralError::IvanlidParam, "UID incorrect size");
this->licData.uid = uid;
}
else

View File

@@ -112,6 +112,7 @@ bool LicenceReader::initread(int elcType, InitStructure &initStructure)
{
Reader::Licence3 licenceELC3 = Reader::Licence3(this->licIdentification);
this->licence3 = &licenceELC3;
this->licence3->uid_path = initStructure.uid_filePath;
licenceELC3.licenceFilePath = initStructure.licenceFilePath;
this->licence3->readLicence(&this->licencesInfo);
this->licInfo.licenceFileName = this->licence3->licFileName;

View File

@@ -20,8 +20,8 @@ namespace Reader
bool Licence3::readLicence(LicenceInfoGeneral *licences)
{
//uid load
if (getUID() == false) throw LicenceException((int)GeneralError::UIDReadError, "Nepodařilo se načíst UID: " + uid_path);
if (this->uid.length() < UID_LENGTH) throw LicenceException((int)GeneralError::UIDReadError, "UID nemá požadovanou velikost: " + uid_path);
string licFileName = getLicenceName();
string licFilePath = this->licenceFilePath + licFileName;
@@ -35,8 +35,6 @@ namespace Reader
throw LicenceException((int)GeneralError::FileOpenError, "Chyba otevření souboru licence: " + licFilePath);
}
#ifdef SHOW
cout << "Celý vstup zašifrovaný: \n";
for (const auto &x : content)
@@ -192,6 +190,7 @@ namespace Reader
this->uid = string(content.begin(), content.end());
return true;
}