Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a5139db75a | |||
| e21828d63f | |||
| 4dcd40aadf |
@@ -2,6 +2,9 @@
|
||||
|
||||
Generování licence pro SD kartu
|
||||
|
||||
## version 1.1
|
||||
- oprava #define direktiv pro celý kod (zapínání debugu, detailního výpisu a kompletního zakomentování kodu)
|
||||
|
||||
## version 1.0
|
||||
- startovací publikační verze. Implementováno generování a čtení ELC1, ELC2 i ELC3
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ RUN chmod 755 /app/start.sh
|
||||
COPY ./startok.sh /app/
|
||||
RUN chmod 755 /app/startok.sh
|
||||
|
||||
COPY ./startuid.sh /app/
|
||||
RUN chmod 755 /app/startuid.sh
|
||||
|
||||
COPY ./lread.sh /app/
|
||||
RUN chmod 755 /app/lread.sh
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef SDCARD_H_
|
||||
#define SDCARD_H_
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#define CID_LENGTH 32
|
||||
#define CSD_LENGTH 32
|
||||
|
||||
|
||||
7
include/common/licConnector.h
Normal file
7
include/common/licConnector.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef LICCONNECTOR_H_INCLUDED
|
||||
#define LICCONNECTOR_H_INCLUDED
|
||||
|
||||
#include "lic_config.h"
|
||||
//#include "../../_src/_main/Ez_automaincfg.h"
|
||||
|
||||
#endif // LICCONNECTOR_H_INCLUDED
|
||||
7
include/common/lic_config.h
Normal file
7
include/common/lic_config.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef LIC_CONFIG_H_INCLUDED
|
||||
#define LIC_CONFIG_H_INCLUDED
|
||||
|
||||
//#define EZ_LIC_DEBUG //zapíná debug pro windows. Pro produkci je potřeba nechat zakomentované
|
||||
//#define EZ_LIC_DEBUG_SHOW_DETAILS //zapíná detailní výpis při čtení licene. Pro produkci je potřeba nechat zakomentované
|
||||
|
||||
#endif
|
||||
@@ -1,10 +1,11 @@
|
||||
#ifndef LICENCE_COMMON_H_
|
||||
#define LICENCE_COMMON_H_
|
||||
|
||||
#include "licConnector.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#define CRC = 1
|
||||
|
||||
#ifndef LICENCE_COMMON_H_
|
||||
#define LICENCE_COMMON_H_
|
||||
|
||||
//---------------- společná hlavička pro všechny licence ----------------
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef PLC_LICENCE1_COMMON_H
|
||||
#define PLC_LICENCE1_COMMON_H
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include <vector>
|
||||
#include "licenceCommon.h"
|
||||
#include "SDCard.h"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef PLC_LICENCE2_COMMON_H
|
||||
#define PLC_LICENCE2_COMMON_H
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include <vector>
|
||||
#include "licenceCommon.h"
|
||||
#include "SDCard.h"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef PLC_LICENCE3_COMMON_H
|
||||
#define PLC_LICENCE3_COMMON_H
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#define UID_LENGTH 32
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef UTILS_H_
|
||||
#define UTILS_H_
|
||||
|
||||
#include "licConnector.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "licenceCommon.h"
|
||||
|
||||
#ifndef LICENCE_GENERATOR_H_
|
||||
#define LICENCE_GENERATOR_H_
|
||||
|
||||
@@ -8,7 +10,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include "pugixml.hpp"
|
||||
#include "licenceCommon.h"
|
||||
|
||||
#include "licGenELC1.h"
|
||||
#include "licGenELC2.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef ELC1_READER__H
|
||||
#define ELC1_READER__H
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "licenceCommon.h"
|
||||
#include "licenceELC1.h"
|
||||
#include "SDCard.h"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
#ifndef ELC2_READER_H
|
||||
#define ELC2_READER_H
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "licenceCommon.h"
|
||||
#include "licenceELC2.h"
|
||||
#include "SDCard.h"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef ELC3_READER__H
|
||||
#define ELC3_READER__H
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "licenceCommon.h"
|
||||
#include "licenceELC3.h"
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#ifndef LICENCE_READER_H_
|
||||
#define LICENCE_READER_H_
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "SDCard.h"
|
||||
#include "licReaderELC1.h"
|
||||
#include "licReaderELC2.h"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
output/ezlic_eovosv0_wqxcyjpdxji.lica
Normal file
BIN
output/ezlic_eovosv0_wqxcyjpdxji.lica
Normal file
Binary file not shown.
@@ -1,8 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<licence elc="1" xmlVersion="1" revision="1" compatibility="1">
|
||||
<licenceType licenceVersion="1" licenceIndex="0">EOV_OSV</licenceType>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<licence elc="3" xmlVersion="1" revision="1" compatibility="1">
|
||||
<licenceType licenceVersion="1" licenceIndex="0">DRT</licenceType>
|
||||
<plcType>wago</plcType>
|
||||
<licenceName>Licence pro EOV_OSV</licenceName>
|
||||
<station>zst.ceskatrebova.ddts.cz</station>
|
||||
<distributor>ROV21</distributor>
|
||||
<project>Licence ELC3</project>
|
||||
<items>
|
||||
<item>
|
||||
<name>pt_Ez_interHW</name>
|
||||
<protoId>0</protoId>
|
||||
<dataPointsCount>3</dataPointsCount>
|
||||
</item>
|
||||
<item>
|
||||
<name>pt_Ez_buffer</name>
|
||||
<protoId>1</protoId>
|
||||
<dataPointsCount>4294967295</dataPointsCount>
|
||||
</item>
|
||||
<item>
|
||||
<name>pt_Ez_webs</name>
|
||||
<protoId>2</protoId>
|
||||
<dataPointsCount>4294967295</dataPointsCount>
|
||||
</item>
|
||||
<item>
|
||||
<name>pt_Ez_iec104c</name>
|
||||
<protoId>5</protoId>
|
||||
<dataPointsCount>55</dataPointsCount>
|
||||
</item>
|
||||
<item>
|
||||
<name>pt_Ez_iec104s</name>
|
||||
<protoId>6</protoId>
|
||||
<dataPointsCount>66</dataPointsCount>
|
||||
</item>
|
||||
<item>
|
||||
<name>pt_Ez_iec61850c</name>
|
||||
<protoId>7</protoId>
|
||||
<dataPointsCount>77</dataPointsCount>
|
||||
</item>
|
||||
</items>
|
||||
</licence>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<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>zst.ceskatrebova.ddts.cz</station>
|
||||
<distributor>ROV21</distributor>
|
||||
</licence>
|
||||
Binary file not shown.
@@ -1,17 +1,15 @@
|
||||
#include "reader/licenceReader.h"
|
||||
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
#define LINUX 1
|
||||
//#define WINDOWS 1
|
||||
//#define READ 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include "licenceGenerator.h"
|
||||
#include "reader/licenceReader.h"
|
||||
|
||||
/// @brief hlavní funkce
|
||||
/// @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
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#include "licenceReader.h"
|
||||
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#define LINUX 1
|
||||
//#define WINDOWS 1
|
||||
|
||||
#include "licenceReader.h"
|
||||
|
||||
/// @brief hlavní funkce
|
||||
/// @param argc
|
||||
/// @param argv parametry pro generování licence
|
||||
/// @return
|
||||
int main9()
|
||||
int main()
|
||||
{
|
||||
// buffer,850client,104client, 104server, web
|
||||
// kouknout na unikatní klíc pro linux (native uid, i openssl neco má)
|
||||
@@ -26,31 +24,25 @@ int main9()
|
||||
initStructure.cid_csd_filePath = ""; // cesta k cidu/csd pro načtení a kontrolu licence
|
||||
initStructure.uid_filePath = ""; // cesta k souboru machine-id. (/etc/machine-id), takze by mělo být /etc/.
|
||||
|
||||
|
||||
//---------------------------------------- ELC3 ----------------------------------------------------------
|
||||
//verze ELC 3 pro jeden protokol. Oproti ELC2 je potřeba přidat cestu k uid/machine-id v initStructure
|
||||
LicenceReader licenceReaderELC3{};
|
||||
if (licenceReaderELC3.initread(3, initStructure)) // iniciacni nacteni
|
||||
//verze původní ELC 1, zatím zůstává staré řešení
|
||||
LicenceReader licenceReaderELC1{};
|
||||
if (licenceReaderELC1.initread(1, initStructure)) // iniciacni nacteni
|
||||
{
|
||||
LicenceELC3Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo1, LicenceInfo2, LicenceInfo3)
|
||||
// if ()
|
||||
int protocolId = 7;
|
||||
|
||||
if (licenceReaderELC3.getLicenceItemInfo(protocolId, &info))
|
||||
LicenceELC1Info info; // struktura pro ELC1. Nemá tam asi nic jiného smysl nez true/false
|
||||
if (licenceReaderELC1.getLicenceInfo(&info))
|
||||
{
|
||||
cout << "Pocet licencních bodu pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
|
||||
if (info.isValid)
|
||||
cout << "Platna licence ELC1 \n";
|
||||
else
|
||||
cout << "Neplatna licence ELC1\n";
|
||||
}
|
||||
else
|
||||
cout << "Tento protokol nemá body";
|
||||
cout << "CHYBA: " << licenceReaderELC1.error.message;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "CHYBA: " << licenceReaderELC3.error.message;
|
||||
cout << "CHYBA: " << licenceReaderELC1.error.message;
|
||||
}
|
||||
//---------------------------------------- ELC3 ----------------------------------------------------------
|
||||
system("pause");
|
||||
return SUCCES;
|
||||
|
||||
|
||||
// verze ELC 2 pro jeden protokol
|
||||
LicenceReader licenceReaderELC2{};
|
||||
@@ -96,6 +88,32 @@ int main9()
|
||||
cout << "CHYBA: " << licenceReaderELC2.error.message;
|
||||
}
|
||||
|
||||
//---------------------------------------- ELC3 ----------------------------------------------------------
|
||||
//verze ELC 3 pro jeden protokol. Oproti ELC2 je potřeba přidat cestu k uid/machine-id v initStructure
|
||||
LicenceReader licenceReaderELC3{};
|
||||
if (licenceReaderELC3.initread(3, initStructure)) // iniciacni nacteni
|
||||
{
|
||||
LicenceELC3Item info; // podle ELC a kompatibility určit strukuru (LicenceInfo1, LicenceInfo2, LicenceInfo3)
|
||||
// if ()
|
||||
int protocolId = 7;
|
||||
|
||||
if (licenceReaderELC3.getLicenceItemInfo(protocolId, &info))
|
||||
{
|
||||
cout << "Pocet licencních bodu pro " << info.protocolId << ": " << info.dataPointsCount << std::endl;
|
||||
}
|
||||
else
|
||||
cout << "Tento protokol nemá body";
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "CHYBA: " << licenceReaderELC3.error.message;
|
||||
}
|
||||
//---------------------------------------- ELC3 ----------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// verze ELC 2 kompletní načtení
|
||||
/*
|
||||
LicenceReader licenceReaderCompleteELC2{};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "utils.h"
|
||||
#include "SDCard.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
SDCard::SDCard()
|
||||
{
|
||||
|
||||
3
src/common/SDCard.d
Normal file
3
src/common/SDCard.d
Normal file
@@ -0,0 +1,3 @@
|
||||
src/common/SDCard.o: src/common/SDCard.cpp include/common/SDCard.h \
|
||||
include/common/utils.h include/common/licConnector.h \
|
||||
include/common/lic_config.h
|
||||
BIN
src/common/SDCard.o
Normal file
BIN
src/common/SDCard.o
Normal file
Binary file not shown.
@@ -1,8 +1,5 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
|
||||
#include "licenceELC1.h"
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#define CID_LENGTH 32
|
||||
#define CSD_LENGTH 32
|
||||
|
||||
4
src/common/licenceELC1.d
Normal file
4
src/common/licenceELC1.d
Normal file
@@ -0,0 +1,4 @@
|
||||
src/common/licenceELC1.o: src/common/licenceELC1.cpp \
|
||||
include/common/licenceELC1.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/SDCard.h
|
||||
BIN
src/common/licenceELC1.o
Normal file
BIN
src/common/licenceELC1.o
Normal file
Binary file not shown.
@@ -1,8 +1,5 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
|
||||
#include "licenceELC2.h"
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
LicenceELC2::LicenceELC2() {}
|
||||
|
||||
|
||||
4
src/common/licenceELC2.d
Normal file
4
src/common/licenceELC2.d
Normal file
@@ -0,0 +1,4 @@
|
||||
src/common/licenceELC2.o: src/common/licenceELC2.cpp \
|
||||
include/common/licenceELC2.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/SDCard.h
|
||||
BIN
src/common/licenceELC2.o
Normal file
BIN
src/common/licenceELC2.o
Normal file
Binary file not shown.
@@ -1,7 +1,5 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "licenceELC3.h"
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
LicenceELC3::LicenceELC3() {}
|
||||
|
||||
|
||||
4
src/common/licenceELC3.d
Normal file
4
src/common/licenceELC3.d
Normal file
@@ -0,0 +1,4 @@
|
||||
src/common/licenceELC3.o: src/common/licenceELC3.cpp \
|
||||
include/common/licenceELC3.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h
|
||||
BIN
src/common/licenceELC3.o
Normal file
BIN
src/common/licenceELC3.o
Normal file
Binary file not shown.
@@ -1,11 +1,10 @@
|
||||
|
||||
#include "utils.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
//#define WINDOWS 1
|
||||
#define LINUX 1
|
||||
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/ssl.h> /* core library */
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -93,8 +92,8 @@ DATE getLicDate()
|
||||
int seconds = 1 * local_time->tm_sec;
|
||||
int totalSeconds = hoursSeconds + minutesSeconds + seconds;
|
||||
|
||||
#ifdef WINDOWS
|
||||
DATE dateOnly = ttime - totalSeconds + 7200; // (pro windows); // 7200 + vteřina za dvě hodiny pro srování
|
||||
#ifdef EZ_LIC_DEBUG
|
||||
DATE dateOnly = ttime - totalSeconds + 7200; // (pro win); // 7200 + vteřina za dvě hodiny pro srování
|
||||
#else
|
||||
DATE dateOnly = ttime - totalSeconds;
|
||||
#endif
|
||||
@@ -337,7 +336,7 @@ unordered_map<string, string> getArguments(int argc, char *argv[])
|
||||
|
||||
string getCompletePath(string fileName)
|
||||
{
|
||||
#ifdef WINDOWS
|
||||
#ifdef EZ_LIC_DEBUG
|
||||
return fileName;
|
||||
#else
|
||||
char path[PATH_MAX + 1] = {};
|
||||
|
||||
29
src/common/utils.d
Normal file
29
src/common/utils.d
Normal file
@@ -0,0 +1,29 @@
|
||||
src/common/utils.o: src/common/utils.cpp include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/openssl/conf.h include/openssl/macros.h \
|
||||
include/openssl/opensslconf.h include/openssl/configuration.h \
|
||||
include/openssl/opensslv.h include/openssl/bio.h include/openssl/e_os2.h \
|
||||
include/openssl/crypto.h include/openssl/safestack.h \
|
||||
include/openssl/stack.h include/openssl/types.h \
|
||||
include/openssl/cryptoerr.h include/openssl/symhacks.h \
|
||||
include/openssl/cryptoerr_legacy.h include/openssl/core.h \
|
||||
include/openssl/bioerr.h include/openssl/lhash.h \
|
||||
include/openssl/conferr.h include/openssl/conftypes.h \
|
||||
include/openssl/ssl.h include/openssl/comp.h include/openssl/comperr.h \
|
||||
include/openssl/x509.h include/openssl/buffer.h \
|
||||
include/openssl/buffererr.h include/openssl/evp.h \
|
||||
include/openssl/core_dispatch.h include/openssl/evperr.h \
|
||||
include/openssl/params.h include/openssl/bn.h include/openssl/bnerr.h \
|
||||
include/openssl/objects.h include/openssl/obj_mac.h \
|
||||
include/openssl/asn1.h include/openssl/asn1err.h \
|
||||
include/openssl/objectserr.h include/openssl/ec.h \
|
||||
include/openssl/ecerr.h include/openssl/rsa.h include/openssl/rsaerr.h \
|
||||
include/openssl/dsa.h include/openssl/dh.h include/openssl/dherr.h \
|
||||
include/openssl/dsaerr.h include/openssl/sha.h include/openssl/x509err.h \
|
||||
include/openssl/x509_vfy.h include/openssl/pkcs7.h \
|
||||
include/openssl/pkcs7err.h include/openssl/http.h include/openssl/pem.h \
|
||||
include/openssl/pemerr.h include/openssl/hmac.h include/openssl/async.h \
|
||||
include/openssl/asyncerr.h include/openssl/ct.h include/openssl/cterr.h \
|
||||
include/openssl/sslerr.h include/openssl/sslerr_legacy.h \
|
||||
include/openssl/prov_ssl.h include/openssl/ssl2.h include/openssl/ssl3.h \
|
||||
include/openssl/tls1.h include/openssl/dtls1.h include/openssl/srtp.h
|
||||
BIN
src/common/utils.o
Normal file
BIN
src/common/utils.o
Normal file
Binary file not shown.
@@ -6,8 +6,6 @@
|
||||
#include "pugixml.hpp"
|
||||
#include <typeinfo>
|
||||
|
||||
#define LINUX 1
|
||||
|
||||
LicenceGenerator::LicenceGenerator()
|
||||
{
|
||||
}
|
||||
@@ -48,7 +46,7 @@ bool LicenceGenerator::processInputConfiguration()
|
||||
char fileName[fileNameLength] = {};
|
||||
getCharsFromString(fullFile, fileName, fileNameLength);
|
||||
|
||||
#ifdef WINDOWS
|
||||
#ifdef EZ_LIC_DEBUG
|
||||
pugi::xml_parse_result result = doc.load_file("licData.xml");
|
||||
#else
|
||||
pugi::xml_parse_result result = doc.load_file(fileName);
|
||||
|
||||
10
src/generator/LicenceGenerator.d
Normal file
10
src/generator/LicenceGenerator.d
Normal file
@@ -0,0 +1,10 @@
|
||||
src/generator/LicenceGenerator.o: src/generator/LicenceGenerator.cpp \
|
||||
include/generator/licenceGenerator.h include/common/licenceCommon.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/generator/pugixml.hpp include/generator/pugiconfig.hpp \
|
||||
include/generator/licGenELC1.h include/common/utils.h \
|
||||
include/common/licenceELC1.h include/common/utils.h \
|
||||
include/common/licenceCommon.h include/common/SDCard.h \
|
||||
include/common/SDCard.h include/generator/licGenELC2.h \
|
||||
include/common/licenceELC2.h include/generator/licGenELC3.h \
|
||||
include/common/licenceELC3.h include/generator/pugixml.hpp
|
||||
BIN
src/generator/LicenceGenerator.o
Normal file
BIN
src/generator/LicenceGenerator.o
Normal file
Binary file not shown.
@@ -34,7 +34,7 @@ namespace Generator
|
||||
getCharsFromString(fullFile, fileName, fileNameLength);
|
||||
|
||||
pugi::xml_document doc;
|
||||
#ifdef WINDOWS
|
||||
#ifdef EZ_LIC_DEBUG
|
||||
pugi::xml_parse_result result = doc.load_file("licData.xml");
|
||||
#else
|
||||
pugi::xml_parse_result result = doc.load_file(fileName);
|
||||
@@ -186,7 +186,7 @@ namespace Generator
|
||||
|
||||
if (binaryGeneration == BinaryGenerationType::File)
|
||||
{
|
||||
#ifdef WINDOWS
|
||||
#ifdef EZ_LIC_DEBUG
|
||||
|
||||
char licFileNameToSave[licenseFileName.length()] = {};
|
||||
getCharsFromString(licenseFileName, licFileNameToSave, licenseFileName.length());
|
||||
|
||||
7
src/generator/licGenELC1.d
Normal file
7
src/generator/licGenELC1.d
Normal file
@@ -0,0 +1,7 @@
|
||||
src/generator/licGenELC1.o: src/generator/licGenELC1.cpp \
|
||||
include/generator/licGenELC1.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/licenceELC1.h \
|
||||
include/common/utils.h include/common/licenceCommon.h \
|
||||
include/common/SDCard.h include/common/SDCard.h \
|
||||
include/generator/pugixml.hpp include/generator/pugiconfig.hpp
|
||||
BIN
src/generator/licGenELC1.o
Normal file
BIN
src/generator/licGenELC1.o
Normal file
Binary file not shown.
7
src/generator/licGenELC2.d
Normal file
7
src/generator/licGenELC2.d
Normal file
@@ -0,0 +1,7 @@
|
||||
src/generator/licGenELC2.o: src/generator/licGenELC2.cpp \
|
||||
include/generator/licGenELC2.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/licenceELC2.h \
|
||||
include/common/utils.h include/common/licenceCommon.h \
|
||||
include/common/SDCard.h include/common/SDCard.h \
|
||||
include/generator/pugixml.hpp include/generator/pugiconfig.hpp
|
||||
BIN
src/generator/licGenELC2.o
Normal file
BIN
src/generator/licGenELC2.o
Normal file
Binary file not shown.
@@ -211,7 +211,7 @@ namespace Generator
|
||||
|
||||
appendStringToVector(this->licBody.publicHeader, publicContent);
|
||||
|
||||
#ifdef CRCCHECK
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "CRC public size: " << publicContent.size() << "\n";
|
||||
cout << "CRC gen public: " << calculateCRC16(publicContent) << "\n";
|
||||
#endif
|
||||
@@ -240,7 +240,7 @@ namespace Generator
|
||||
privateContent.push_back((dataItem.licCount >> 24) & 0xFF);
|
||||
}
|
||||
|
||||
#ifdef CRCCHECK
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "CRC private size: " << privateContent.size() << "\n";
|
||||
cout << "CRC gen private: " << calculateCRC16(privateContent) << "\n";
|
||||
#endif
|
||||
@@ -248,7 +248,7 @@ namespace Generator
|
||||
vector<unsigned char> completeVector = joinVectors(publicContent, privateContent);
|
||||
uint16_t crcComplete = calculateCRC16(completeVector);
|
||||
|
||||
#ifdef CRCCHECK
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "CRC complete size: " << completeVector.size() << "\n";
|
||||
cout << "CRC gen complete: " << crcComplete << "\n";
|
||||
#endif
|
||||
|
||||
6
src/generator/licGenELC3.d
Normal file
6
src/generator/licGenELC3.d
Normal file
@@ -0,0 +1,6 @@
|
||||
src/generator/licGenELC3.o: src/generator/licGenELC3.cpp \
|
||||
include/generator/licGenELC3.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/licenceELC3.h \
|
||||
include/common/utils.h include/common/licenceCommon.h \
|
||||
include/generator/pugixml.hpp include/generator/pugiconfig.hpp
|
||||
BIN
src/generator/licGenELC3.o
Normal file
BIN
src/generator/licGenELC3.o
Normal file
Binary file not shown.
2
src/generator/pugixml.d
Normal file
2
src/generator/pugixml.d
Normal file
@@ -0,0 +1,2 @@
|
||||
src/generator/pugixml.o: src/generator/pugixml.cpp \
|
||||
include/generator/pugixml.hpp include/generator/pugiconfig.hpp
|
||||
BIN
src/generator/pugixml.o
Normal file
BIN
src/generator/pugixml.o
Normal file
Binary file not shown.
@@ -1,7 +1,5 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
|
||||
#include <licenceReader.h>
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
ELCType licElcType = ELCType::ELC2;
|
||||
LicenceType licLicenceType;
|
||||
|
||||
9
src/reader/LicenceReader.d
Normal file
9
src/reader/LicenceReader.d
Normal file
@@ -0,0 +1,9 @@
|
||||
src/reader/LicenceReader.o: src/reader/LicenceReader.cpp \
|
||||
include/reader/licenceReader.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/SDCard.h include/common/utils.h \
|
||||
include/reader/licReaderELC1.h include/common/licenceCommon.h \
|
||||
include/common/licenceELC1.h include/common/licenceCommon.h \
|
||||
include/common/SDCard.h include/reader/licReaderELC2.h \
|
||||
include/common/licenceELC2.h include/reader/licReaderELC3.h \
|
||||
include/common/licenceELC3.h
|
||||
BIN
src/reader/LicenceReader.o
Normal file
BIN
src/reader/LicenceReader.o
Normal file
Binary file not shown.
@@ -1,6 +1,5 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "licReaderELC1.h"
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
namespace Reader
|
||||
{
|
||||
|
||||
6
src/reader/licReaderELC1.d
Normal file
6
src/reader/licReaderELC1.d
Normal file
@@ -0,0 +1,6 @@
|
||||
src/reader/licReaderELC1.o: src/reader/licReaderELC1.cpp \
|
||||
include/reader/licReaderELC1.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/licenceELC1.h \
|
||||
include/common/utils.h include/common/licenceCommon.h \
|
||||
include/common/SDCard.h include/common/SDCard.h
|
||||
BIN
src/reader/licReaderELC1.o
Normal file
BIN
src/reader/licReaderELC1.o
Normal file
Binary file not shown.
@@ -1,8 +1,6 @@
|
||||
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "licReaderELC2.h"
|
||||
#define SHOW6 1
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
namespace Reader
|
||||
{
|
||||
@@ -36,7 +34,7 @@ namespace Reader
|
||||
throw LicenceException((int)GeneralError::FileOpenError, "Chyba otevření souboru licence: " + licFilePath);
|
||||
}
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "Celý vstup zašifrovaný: \n";
|
||||
for (const auto &x : content) cout << (int)x << "-";
|
||||
cout << "\n";
|
||||
@@ -66,12 +64,12 @@ namespace Reader
|
||||
|
||||
vector<unsigned char> publicPart(content.begin(), content.begin() + 18 + this->licBody.licenceIdentHeader.publicHeaderLength);
|
||||
|
||||
#ifdef CRCCHECK
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "CRC read public size: " << publicPart.size() << "\n";
|
||||
cout << "CRC read public: " << calculateCRC16(publicPart) << "\n";
|
||||
#endif
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "\n public header length: " << licBody.licenceIdentHeader.publicHeaderLength << "\n" ;
|
||||
#endif
|
||||
|
||||
@@ -87,7 +85,7 @@ namespace Reader
|
||||
privateContentDecrypted = decryptPrivateContent(encryptedPart);
|
||||
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "private encryptedsize: " << encryptedPart.size() << "\n";
|
||||
cout << "private decryptedsize: " << privateContentDecrypted.size() << "\n";
|
||||
cout << "private decrypted: \n";
|
||||
@@ -95,7 +93,7 @@ namespace Reader
|
||||
cout << "\n";
|
||||
#endif
|
||||
|
||||
#ifdef CRCCHECK
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "CRC read private size: " << privateContentDecrypted.size() << "\n";
|
||||
cout << "CRC read private: " << calculateCRC16(privateContentDecrypted) << "\n";
|
||||
#endif
|
||||
@@ -114,7 +112,7 @@ namespace Reader
|
||||
throw LicenceException((int)GeneralError::ItemsCountMismatch, "Nesouhlasí počet položek licence.");
|
||||
}
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "velikost: " << sizeof(licBodyDecrypted.licenceIdentHeader) << "\n";
|
||||
#endif
|
||||
|
||||
@@ -135,7 +133,7 @@ namespace Reader
|
||||
|
||||
uint16_t crcCalculated = calculateCRC16(completeVector, 2);
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
// cout << "content: \n";
|
||||
// for (const auto x : content) cout << (int)x << "-";
|
||||
|
||||
|
||||
6
src/reader/licReaderELC2.d
Normal file
6
src/reader/licReaderELC2.d
Normal file
@@ -0,0 +1,6 @@
|
||||
src/reader/licReaderELC2.o: src/reader/licReaderELC2.cpp \
|
||||
include/reader/licReaderELC2.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/licenceELC2.h \
|
||||
include/common/utils.h include/common/licenceCommon.h \
|
||||
include/common/SDCard.h include/common/SDCard.h
|
||||
BIN
src/reader/licReaderELC2.o
Normal file
BIN
src/reader/licReaderELC2.o
Normal file
Binary file not shown.
@@ -1,7 +1,5 @@
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
#include "licReaderELC3.h"
|
||||
// #define SHOW 1
|
||||
#ifndef EZ_APPLICATION_LICENCE_DISABLE
|
||||
|
||||
namespace Reader
|
||||
{
|
||||
@@ -35,7 +33,7 @@ namespace Reader
|
||||
throw LicenceException((int)GeneralError::FileOpenError, "Chyba otevření souboru licence: " + licFilePath);
|
||||
}
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "Celý vstup zašifrovaný: \n";
|
||||
for (const auto &x : content)
|
||||
cout << (int)x << "-";
|
||||
@@ -65,12 +63,12 @@ namespace Reader
|
||||
vector<unsigned char> publicPart(content.begin(), content.begin() + 12 + this->licBody.licenceIdentHeader.publicHeaderLength);
|
||||
|
||||
|
||||
#ifdef CRCCHECK
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "CRC read public size: " << publicPart.size() << "\n";
|
||||
cout << "CRC read public: " << calculateCRC16(publicPart) << "\n";
|
||||
#endif
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "\n public header length: " << licBody.licenceIdentHeader.publicHeaderLength << "\n";
|
||||
#endif
|
||||
|
||||
@@ -88,7 +86,7 @@ namespace Reader
|
||||
|
||||
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "private encryptedsize: " << encryptedPart.size() << "\n";
|
||||
cout << "private decryptedsize: " << privateContentDecrypted.size() << "\n";
|
||||
cout << "private decrypted: \n";
|
||||
@@ -97,7 +95,7 @@ namespace Reader
|
||||
cout << "\n";
|
||||
#endif
|
||||
|
||||
#ifdef CRCCHECK
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "CRC read private size: " << privateContentDecrypted.size() << "\n";
|
||||
cout << "CRC read private: " << calculateCRC16(privateContentDecrypted) << "\n";
|
||||
#endif
|
||||
@@ -115,7 +113,7 @@ namespace Reader
|
||||
throw LicenceException((int)GeneralError::ItemsCountMismatch, "Nesouhlasí počet položek licence.");
|
||||
}
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
cout << "velikost: " << sizeof(licBodyDecrypted.licenceIdentHeader) << "\n";
|
||||
#endif
|
||||
|
||||
@@ -136,7 +134,7 @@ namespace Reader
|
||||
|
||||
uint16_t crcCalculated = calculateCRC16(completeVector, 2);
|
||||
|
||||
#ifdef SHOW
|
||||
#ifdef EZ_LIC_DEBUG_SHOW_DETAILS
|
||||
// cout << "content: \n";
|
||||
// for (const auto x : content) cout << (int)x << "-";
|
||||
|
||||
|
||||
5
src/reader/licReaderELC3.d
Normal file
5
src/reader/licReaderELC3.d
Normal file
@@ -0,0 +1,5 @@
|
||||
src/reader/licReaderELC3.o: src/reader/licReaderELC3.cpp \
|
||||
include/reader/licReaderELC3.h include/common/utils.h \
|
||||
include/common/licConnector.h include/common/lic_config.h \
|
||||
include/common/licenceCommon.h include/common/licenceELC3.h \
|
||||
include/common/utils.h include/common/licenceCommon.h
|
||||
BIN
src/reader/licReaderELC3.o
Normal file
BIN
src/reader/licReaderELC3.o
Normal file
Binary file not shown.
Reference in New Issue
Block a user