Files
EgtLock/DongleId.cpp
T
Dario Sassi 07e9914302 EgtLock 1.6g8 :
- aggiunta gestione chiavi hardware OxySec
- spostati Base64 e Crc32 in General.
2015-07-29 07:03:48 +00:00

80 lines
2.3 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2015-2015
//----------------------------------------------------------------------------
// File : DongleId.cpp Data : 27.07.15 Versione : 1.6g1
// Contenuto : Funzioni per gestione/calcolo Id chiave OxySec.
//
//
//
// Modifiche : 27.07.15 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//------------------ Include -------------------------------------------------
#include "stdafx.h"
#include "Obfuscate.h"
#include "DongleId.h"
#include "/EgtDev/Include/EgtBase64.h"
#include "/EgtDev/Include/EgtCrc32.h"
#include "/EgtDev/Extern/OxySec/Include/xlt.h"
using namespace std ;
//----------------------------------------------------------------------------
bool
GetDongleId( string& sDongleId)
{
// cerco la chiave
unsigned char label[XLT_LABEL_SIZE] ;
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 device = xlt_locate( label) ;
if ( device < 0)
return false ;
// richiamo funzioni di verifica chiave con decifratura RSA 512 di dati generati al volo
// ... DA FARE ...
// leggo l'identificativo della chiave dal banco 0
unsigned char pwd[XLT_PASSWORD_SIZE] ;
unsigned char data[XLT_BANK_SIZE] ;
// M0nt3ReC@st3llo1985
pwd[ 0] = 'M' ;
pwd[ 2] = 'n' ;
pwd[ 4] = '3' ;
pwd[ 6] = 'e' ;
pwd[ 8] = '@' ;
pwd[10] = 't' ;
pwd[12] = 'l' ;
pwd[14] = 'o' ;
pwd[16] = '9' ;
pwd[18] = '5' ;
pwd[20] = '\0' ;
pwd[22] = '\0' ;
pwd[24] = '\0' ;
pwd[26] = '\0' ;
pwd[28] = '\0' ;
pwd[30] = '\0' ;
pwd[ 1] = '0' ;
pwd[ 3] = 't' ;
pwd[ 5] = 'R' ;
pwd[ 7] = 'C' ;
pwd[ 9] = 's' ;
pwd[11] = '3' ;
pwd[13] = 'l' ;
pwd[15] = '1' ;
pwd[17] = '8' ;
pwd[19] = '\0' ;
pwd[21] = '\0' ;
pwd[23] = '\0' ;
pwd[25] = '\0' ;
pwd[27] = '\0' ;
pwd[29] = '\0' ;
pwd[31] = '\0' ;
int status = xlt_read( device, pwd, 0, data) ;
if ( status != XLT_ERROR_SUCCESS)
return false ;
sDongleId = (char*) data ;
return true ;
}