ELC 3
This commit is contained in:
2
Makefile
2
Makefile
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
@@ -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>
|
||||
@@ -1 +1 @@
|
||||
9a2314bcee131834715adcabc506724c
|
||||
a3395d1b898b4fdbbd563f9c75b3e885
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user