EgtLock :
- gestione più utenti (per ora max 3) sulla chiave di rete.
This commit is contained in:
+11
-18
@@ -19,6 +19,7 @@
|
||||
#include "NetDongleId.h"
|
||||
#include "DongleSN.h"
|
||||
#include "Obfuscate.h"
|
||||
#include "/EgtDev/Include/EgtStringBase.h"
|
||||
#include "/EgtDev/Include/EgtBase64.h"
|
||||
#include "/EgtDev/Include/EgtCrc32.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
@@ -68,27 +69,19 @@ GetLockId( string& sLockId)
|
||||
{
|
||||
switch ( s_nLockType) {
|
||||
default : // KEY_LOCK_TYPE_ANY
|
||||
if ( ! s_bNetHwKey) {
|
||||
if ( GetDongleId( sLockId))
|
||||
return true ;
|
||||
}
|
||||
else {
|
||||
if ( GetNetDongleId( sLockId))
|
||||
return true ;
|
||||
}
|
||||
return GetMachineId( sLockId) ;
|
||||
if ( s_bNetHwKey)
|
||||
return GetNetDongleId( s_nNetUserId, sLockId) ;
|
||||
else if ( GetDongleId( sLockId))
|
||||
return true ;
|
||||
else
|
||||
return GetMachineId( sLockId) ;
|
||||
case KEY_LOCK_TYPE_SW :
|
||||
return GetMachineId( sLockId) ;
|
||||
case KEY_LOCK_TYPE_HW :
|
||||
if ( ! s_bNetHwKey) {
|
||||
if ( GetDongleId( sLockId))
|
||||
return true ;
|
||||
}
|
||||
else {
|
||||
if ( GetNetDongleId( sLockId))
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
if ( ! s_bNetHwKey)
|
||||
return GetDongleId( sLockId) ;
|
||||
else
|
||||
return GetNetDongleId( s_nNetUserId, sLockId) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+65
-6
@@ -26,16 +26,24 @@ static XND_NET_DATA s_net_data = nullptr ;
|
||||
static XND_DEVICE_CONTEXT s_dev_ctx = nullptr ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const char* xnodus_key_blob = "WE5LAQAAAACW6vKd80xDCR_n4048UsW88BFhwxU0vBdAv-SmgK3VJczR_YqmsCTxpcVTqk3LKU3KCTkAWN"\
|
||||
static const char* xnodus_key_blob = "CW6vKd80xDCR_n4048UsW88BFhwxU0vBdAv-SmgK3VJczR_YqmsCTxpcVTqk3LKU3KCTkAWN"\
|
||||
"u5BgL4VU6WM-JvxW-eZHNWaiy5gfNPBVFyoMTI0BbfOF_gQDKe-nvdlMyCZW5gWL6CPUvr3ejSPkyl8atj"\
|
||||
"OZrUUzGSbHuig27z_6NVb2gyVFZJrUUioApP6b96qMIwQS2ME2v99w84pMSids1Okcrl3_aKHRwAH0hMJQ" ;
|
||||
static const char* user1_data_blob = "DHn2Cq9uYJKBJUYCRuVyQI_oQ7qenvAqHuBKhabdZb9mwJwDTCmoiTxqBgYxT5t0Q"\
|
||||
"M7A3hGZfYyr-awKBgExnp_AQ4BygFh-cnghDt2g7A33WxsXKNwK_hHSuYCQ5Smv_6ua_T6TdN4g"\
|
||||
"DDWnaeY0jy5ad_OAzLgtPN0_zXXF9zFiyouqzwnQyCboeT7jJoU_L8zzSdnDFUbLxU-P_OnJ_e2"\
|
||||
"UaD47FiEwQLWzjhTz_-VIgrY7XImgmc-eQsby5xoEkIVt9S0Cc5hrmGt_0uGtdc" ;
|
||||
static const char* user2_data_blob = "DHn2Cq9uYJKBJUYCRuVyQIz9JWqyWVZUjw3zdhJQh0UBbIhfWJBRzZG2l3fRk83Yw"\
|
||||
"dyFMPUWdRN6TwYzvn_t1ie1WnX20_3VC1pEMfwUyM8SKT_QU38DqhNhh2GSzAQoeU9GxzyUptxX"\
|
||||
"t9AGjs0G6e0IuDQHvhRMo3tY2bNNyqitBkhZl35PnaIr8G1vqiWfUMIdNQKmKLRMxzVwfphnb65"\
|
||||
"-3jSoQhjm8qDwWJuiKGlqcLeX0DTvEsW5Oe1EZTUHoAAPSdgz65Wj2H6T0hmPAF" ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
GetNetDongleId( string& sDongleId)
|
||||
GetNetDongleId( int nNetUserId, string& sDongleId)
|
||||
{
|
||||
if ( s_env == nullptr) {
|
||||
if ( ! NetDongleConnect())
|
||||
if ( ! NetDongleConnect( nNetUserId))
|
||||
return false ;
|
||||
}
|
||||
// richiamo funzioni di verifica chiave con decifratura RSA 512 di dati generati al volo
|
||||
@@ -85,7 +93,7 @@ GetNetDongleId( string& sDongleId)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
NetDongleConnect( void)
|
||||
NetDongleConnect( int nNetUserId)
|
||||
{
|
||||
// se connessione già aperta, la chiudo per poi riaprirla
|
||||
if ( s_env != nullptr)
|
||||
@@ -96,7 +104,7 @@ NetDongleConnect( void)
|
||||
return false ;
|
||||
// cerco la chiave di rete
|
||||
unsigned char label[XLT_LABEL_SIZE] ;
|
||||
string sLabel = "EgalTech s.r.l. - CAD/CAM/CIM Software Solutions" ;
|
||||
string sLabel{ "EgalTech s.r.l. - CAD/CAM/CIM Software Solutions"} ;
|
||||
strcpy_s( (char*)label, XLT_LABEL_SIZE, sLabel.c_str()) ;
|
||||
memset( label + sLabel.size(), 0x00, sizeof( label) - sLabel.size()) ;
|
||||
int nStatusND = 0 ;
|
||||
@@ -106,8 +114,59 @@ NetDongleConnect( void)
|
||||
return false ;
|
||||
}
|
||||
// cerco la chiave Xlight virtuale dell'utente anonimo
|
||||
char XnBase[16] ;
|
||||
// WE5LAQAAAA
|
||||
XnBase[6] = 'A' ;
|
||||
XnBase[0] = 'W' ;
|
||||
XnBase[10] = '\0' ;
|
||||
XnBase[1] = 'E' ;
|
||||
XnBase[14] = '\0' ;
|
||||
XnBase[9] = 'A' ;
|
||||
XnBase[2] = '5' ;
|
||||
XnBase[15] = '\0' ;
|
||||
XnBase[7] = 'A' ;
|
||||
XnBase[4] = 'A' ;
|
||||
XnBase[12] = '\0' ;
|
||||
XnBase[5] = 'Q' ;
|
||||
XnBase[13] = '\0' ;
|
||||
XnBase[3] = 'L' ;
|
||||
XnBase[11] = '\0' ;
|
||||
XnBase[8] = 'A' ;
|
||||
char UsBase[16] ;
|
||||
// WE5VAQAAAA
|
||||
UsBase[6] = 'A' ;
|
||||
UsBase[0] = 'W' ;
|
||||
UsBase[10] = '\0' ;
|
||||
UsBase[1] = 'E' ;
|
||||
UsBase[14] = '\0' ;
|
||||
UsBase[9] = 'A' ;
|
||||
UsBase[2] = '5' ;
|
||||
UsBase[15] = '\0' ;
|
||||
UsBase[7] = 'A' ;
|
||||
UsBase[4] = 'A' ;
|
||||
UsBase[12] = '\0' ;
|
||||
UsBase[5] = 'Q' ;
|
||||
UsBase[13] = '\0' ;
|
||||
UsBase[3] = 'V' ;
|
||||
UsBase[11] = '\0' ;
|
||||
UsBase[8] = 'A' ;
|
||||
string sXnKB = string{ XnBase} + xnodus_key_blob ;
|
||||
int nStatusDC = 0 ;
|
||||
s_dev_ctx = xnd_xlt_devctx_xnodus_create2( s_env, s_net_data, xnodus_key_blob, nullptr, 0, XND_XLT_DEVCTX_FLAG_XNODUS_MULTI_INSTANCE, 0, &nStatusDC) ;
|
||||
switch ( nNetUserId) {
|
||||
default :
|
||||
s_dev_ctx = xnd_xlt_devctx_xnodus_create2( s_env, s_net_data, sXnKB.c_str(), nullptr, 0, XND_XLT_DEVCTX_FLAG_XNODUS_MULTI_INSTANCE, 0, &nStatusDC) ;
|
||||
break ;
|
||||
case 1 : {
|
||||
string sUsDB = string{ UsBase} + user1_data_blob ;
|
||||
s_dev_ctx = xnd_xlt_devctx_xnodus_create2( s_env, s_net_data, sXnKB.c_str(), sUsDB.c_str(), 0, XND_XLT_DEVCTX_FLAG_XNODUS_MULTI_INSTANCE, 0, &nStatusDC) ;
|
||||
break ;
|
||||
}
|
||||
case 2 : {
|
||||
string sUsDB = string{ UsBase} + user2_data_blob ;
|
||||
s_dev_ctx = xnd_xlt_devctx_xnodus_create2( s_env, s_net_data, sXnKB.c_str(), sUsDB.c_str(), 0, XND_XLT_DEVCTX_FLAG_XNODUS_MULTI_INSTANCE, 0, &nStatusDC) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
if ( s_dev_ctx == nullptr) {
|
||||
xnd_xlt_env_release( s_env) ;
|
||||
s_env = nullptr ;
|
||||
|
||||
+2
-2
@@ -16,6 +16,6 @@
|
||||
#include <string>
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
bool GetNetDongleId( std::string& sDongleId) ;
|
||||
bool NetDongleConnect( void) ;
|
||||
bool GetNetDongleId( int nNetUserId, std::string& sDongleId) ;
|
||||
bool NetDongleConnect( int nNetUserId) ;
|
||||
bool NetDongleClose( void) ;
|
||||
|
||||
Reference in New Issue
Block a user