#ifndef PLC_LICENCE3_COMMON_H #define PLC_LICENCE3_COMMON_H #include "utils.h" #ifndef EZ_APPLICATION_LICENCE_DISABLE #define UID_LENGTH 32 #include #include "licenceCommon.h" /// @brief společná třída pro pro reader i generator licence typu ELC2 class LicenceELC3 { public: LicenceELC3(); LicenceELC3(LicenceIdentification &licIdentification); ~LicenceELC3(); string licenceFilePath = ""; string licFileName = ""; string uid = ""; BYTE uidb[UID_LENGTH] = {}; string uid_path = ""; ///etc/machine-id Mapping mapping; ErrorMessage errorMessage; struct LicenceId { char licIdent[5] = {'E', 'L', 'C', '0', '_'}; }; // struct __attribute__((__packed__)) LicencePublicHeader struct LicenceIdentDataHeader { BYTE licenceType{}; // EOSEOV, DRT ... BYTE licenceTypeVersion = 1; // verze licence, urcuje nuance sifrování a pojmenování souborů BYTE licenceIndex{}; // puvodní post fix, identifikátor pro více licencí BYTE compatibilityVersion = 1; // udava verzi komplet PrivateContent BYTE licItemCount{}; // počet protokolů v linenci WORD publicHeaderLength{}; // délka veřejné hlavičy // WORD cardSize{}; // velikost SD karty // DWORD serialNumber = {}; // seriove cislo karty }; struct licDataItem { DWORD protoId{}; // id protokolu pro ktery je licence DWORD licCount{}; // pocet datovych bodu licence }; struct PublicHeader { string version = ""; string projectDescription = ""; string date = ""; string licenceType = ""; }; struct PrivateContent // privátní šifrovaná část { LicenceIdentDataHeader licenceIdentHeader{}; vector dataItems{}; WORD crc{}; }; struct LicenceBody { LicenceId licId{}; LicenceIdentDataHeader licenceIdentHeader{}; string publicHeader = ""; // JSON PrivateContent privateContent{}; }; protected: vector cryptPrivateContent(const std::vector &content); vector decryptPrivateContent(const std::vector &content); void initVector(BYTE *iVector, BYTE *key); string getLicenceName(); LicenceBody licBody{}; LicenceIdentification lIdentification{}; private: }; #endif #endif