EgtLock 3.1a1 :
- nuova gestione protezione per versioni da 2801 a 36812 - su versioni 27xx aggiunto salto di 300 per un anno di aggiornamento automatico per poter pssare direttamente a 31xx.
This commit is contained in:
+44
-15
@@ -1,7 +1,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2014-2024
|
||||
// EgalTech 2014-2026
|
||||
//----------------------------------------------------------------------------
|
||||
// File : KeyProc.cpp Data : 24.01.24 Versione : 2.6a1
|
||||
// File : KeyProc.cpp Data : 02.01.26 Versione : 3.1a1
|
||||
// Contenuto : Funzioni per la gestione della chiave.
|
||||
//
|
||||
//
|
||||
@@ -11,6 +11,7 @@
|
||||
// 12.07.16 DS In recupero opzioni, se chiave ko azzero risultati.
|
||||
// 26.12.20 DS Gestione versione MMmm (vecchie chiavi convertite).
|
||||
// 24.01.24 DS Aggiunta GetKeyLevelEx con anche giorni scadenza assistenza.
|
||||
// 02.01.26 DS Aggiunta gestione versioni da 2801 a 36812.
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -30,7 +31,7 @@
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
static const int MIN_DAYS = 20390 ; // giorni dal 01/01/1970 al 29/10/2025
|
||||
static const int MIN_DAYS = 20454 ; // giorni dal 01/01/1970 al 01/01/2026
|
||||
static const int N_STEP = 7 ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -39,20 +40,35 @@ MakeKey( int nProd, int nVer, int nLev, int nExpDays,
|
||||
unsigned int nOpt1, unsigned int nOpt2, int nOptExpDays,
|
||||
const string& sScramKey, string& sKey)
|
||||
{
|
||||
// sistemazioni per nuova versione mensile valide fino alla 2806
|
||||
// ( 16->16, 19->19, 21->21, 22->22, 2201->22, 2202->23 ... 2212->33, 2301->34, 2302->35 ... 2312->45)
|
||||
int nVerNew ;
|
||||
if ( nVer >= 1 && nVer <= 22)
|
||||
// sistemazioni per nuova versione mensile valide fino alla 2712
|
||||
// ( 16->16, 19->19, 21->21, 22->22, 2201->22, 2202->23 ... 2212->33, 2301->34, 2302->35 ... 2312->45, 2701->82 ... 2712->93)
|
||||
// nuove sistemazioni valide dalla 2801 alla 36812 (sempre NNN01 ... NNN12, dove NNN è la versione e il resto è il mese)
|
||||
int nVerNew = 0 ;
|
||||
int nVerTot = 0 ;
|
||||
int nVerA1 = -1 ;
|
||||
int nVerA2 = -1 ;
|
||||
if ( nVer >= 1 && nVer <= 22) {
|
||||
nVerNew = nVer ;
|
||||
else if ( nVer >= 2201) {
|
||||
int nVerY = ( nVer >= 100 ? nVer / 100 : nVer) ;
|
||||
int nVerM = ( nVer >= 100 ? Clamp( nVer % 100 - 1, 0, 11) : 0) ;
|
||||
nVerTot = nVerNew ;
|
||||
}
|
||||
else if ( nVer >= 2201 && nVer <= 2712) {
|
||||
int nVerY = nVer / 100 ;
|
||||
int nVerM = Clamp( nVer % 100 - 1, 0, 11) ;
|
||||
nVerNew = Clamp( 22 + 12 * ( nVerY - 22) + nVerM, 0, 99) ;
|
||||
nVerTot = nVerNew ;
|
||||
}
|
||||
else if ( nVer >= 2801 && nVer <= 36812) {
|
||||
int nVerY = nVer / 100 ;
|
||||
int nVerM = Clamp( nVer % 100 - 1, 0, 11) ;
|
||||
nVerNew = Clamp( 94 + nVerY % 6, 94, 99) ;
|
||||
nVerTot = Clamp( 12 * ( nVerY - 28) + nVerM, 0, 4095) ;
|
||||
nVerA1 = nVerTot / 64 ;
|
||||
nVerA2 = nVerTot % 64 ;
|
||||
}
|
||||
else
|
||||
return false ;
|
||||
// inizializzo parte pseudorandom
|
||||
srand( nVerNew + nLev) ;
|
||||
srand( nVerTot + nLev) ;
|
||||
// preparo la stringa da criptare
|
||||
string sClearKey ;
|
||||
sClearKey += ToString( ( rand() % 9), 1) ;
|
||||
@@ -62,6 +78,7 @@ MakeKey( int nProd, int nVer, int nLev, int nExpDays,
|
||||
sClearKey += ToString( ( rand() % 9), 1) ;
|
||||
sClearKey += ToString( nExpDays, 6) ;
|
||||
sClearKey += ToString( ( rand() % 9), 1) ;
|
||||
if ( nVerA1 >= 0) sClearKey[16] = nVerA1 + 63 ;
|
||||
sClearKey += " " ;
|
||||
sClearKey[17] = ( nOpt1 >> 0) & 0xFF ;
|
||||
sClearKey[18] = ( nOpt1 >> 8) & 0xFF ;
|
||||
@@ -73,6 +90,7 @@ MakeKey( int nProd, int nVer, int nLev, int nExpDays,
|
||||
sClearKey[23] = ( nOpt2 >> 16) & 0xFF ;
|
||||
sClearKey[24] = ( nOpt2 >> 24) & 0xFF ;
|
||||
sClearKey += ToString( ( rand() % 9), 1) ;
|
||||
if ( nVerA2 >= 0) sClearKey[25] = nVerA2 + 63 ;
|
||||
sClearKey += ToString( nOptExpDays, 6) ;
|
||||
// eseguo la cifratura
|
||||
string sMidKey = sClearKey ;
|
||||
@@ -118,9 +136,18 @@ ReadKey( const string& sKey, const string& sScramKey,
|
||||
( ((unsigned char)sClearKey[23]) << 16) | ( ((unsigned char)sClearKey[24]) << 24) ;
|
||||
if ( ! FromString( sClearKey.substr( 26, 6), nOptExpDays))
|
||||
return false ;
|
||||
// sistemazioni per nuova versione mensile valide fino alla 2806
|
||||
// ( 2201->22, 2202->23 ... 2212->33, 2301->34, 2302->35 ... 2312->45)
|
||||
if ( nVer > 22) {
|
||||
// sistemazioni per nuova versione mensile valide fino alla 2712
|
||||
// ( 16->16, 19->19, 21->21, 22->22, 2201->22, 2202->23 ... 2212->33, 2301->34, 2302->35 ... 2312->45, 2701->82 ... 2712->93)
|
||||
// nuove sistemazioni valide dalla 2801 alla 36812 (sempre NNN01 ... NNN12, dove NNN è la versione e il resto è il mese)
|
||||
if ( nVer > 93) {
|
||||
int nVerA1 = sClearKey[16] - 63 ;
|
||||
int nVerA2 = sClearKey[25] - 63 ;
|
||||
int nVerTot = nVerA1 * 64 + nVerA2 ;
|
||||
int nVerY = 28 + nVerTot / 12 ;
|
||||
int nVerM = nVerTot - ( 12 * ( nVerY - 28)) ;
|
||||
nVer = nVerY * 100 + nVerM + 1 ;
|
||||
}
|
||||
else if ( nVer > 22) {
|
||||
int nVerY = 22 + ( nVer - 22) / 12 ;
|
||||
int nVerM = nVer - ( 22 + 12 * ( nVerY - 22)) ;
|
||||
nVer = nVerY * 100 + nVerM + 1 ;
|
||||
@@ -150,11 +177,13 @@ VerifyKey( const string& sKey, int nProd, int nVer, int nLev,
|
||||
nKProd, nKVer, nKLev, nKExpDays,
|
||||
nKOpt1, nKOpt2, nKOptExpDays))
|
||||
return KEY_ERR_KEYDECODE ;
|
||||
// aggiusto i dati di versione
|
||||
// aggiusto i dati di versione (da 2712 si salta a 3101)
|
||||
if ( nVer < 100)
|
||||
nVer = nVer * 100 + 7 ;
|
||||
if ( nKVer < 100)
|
||||
nKVer = nKVer * 100 + 7 ;
|
||||
else if ( nKVer >= 2701 && nKVer <= 2712)
|
||||
nKVer += 300 ;
|
||||
// verifico dati prodotto
|
||||
if ( ( nProd & nKProd) != nProd)
|
||||
return KEY_ERR_PROD ;
|
||||
|
||||
+1
-1
@@ -119,7 +119,7 @@ CharScramble( char cVal, char cOp)
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// LenMask e Step devono essere primi tra loro e senza sottomultipli in comune :
|
||||
// con LenMask = 24, Step è bene sia 7 o 11, Step 9 non è efficiente.
|
||||
// con LenMask = 24, Step è bene sia 7 o 11, Step 9 non è efficiente.
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ScrambleData( string& sData, const string& sMask, const int nStep)
|
||||
|
||||
Reference in New Issue
Block a user