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