From 5e1e4a4b57e298806dba97175fa1fbd5c771c7cd Mon Sep 17 00:00:00 2001
From: ccy <3140717620@qq.com>
Date: 星期五, 09 十月 2026 16:17:18 +0800
Subject: [PATCH] 新的加密方式

---
 mainwindow.cpp |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/mainwindow.cpp b/mainwindow.cpp
index 1292e42..93e1d2d 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -279,7 +279,6 @@
     QString encryptlocalid = ui->textEdit_localid->toPlainText();
     // 涓�閿В瀵�
     lic2.fromBinary(ShortCrypto::decrypt(encryptlocalid, key));
-    qDebug()<<"on_pushButton_decrypt_clicked"<<lic2.toDebugString();
     //涓庝箣鍓嶇殑鍔犲瘑瀵瑰簲,涓斿幓鎺夊啑浣欎俊鎭�
     localinfo.Baseboard_Uuid = LicenseData::uuidBinaryToString(lic2.boardUuid);
     localinfo.CPU_Processorid = LicenseData::binaryToHexString(lic2.cpuSerial);
@@ -536,13 +535,18 @@
     lic2.expireDate = QDate::fromString(licensedatestr,"yyyy-MM-dd");
 //    lic2.expireDate = lic2.expireDate.addMonths(time);
     lic2.activeState = 1;
-    QString cipher = ShortCrypto::encrypt(lic2.toBinary(), key);
+    // V3绱у噾鏍煎紡锛�28浣嶇函澶у啓锛夛細鏈哄櫒淇℃伅浠ユ寚绾瑰舰寮忕粦瀹�
+    QString cipher = ShortCrypto::encryptRaw(lic2.toBinaryV3(key), key);
     ui->textEdit_licensekey->clear();
     ui->textEdit_licensekey->setPlainText(cipher);
-    // 涓�閿В瀵�
+    // 鍔犲瘑鍚庤嚜妫�
     LicenseData lic3;
-    lic3.fromBinary(ShortCrypto::decrypt(cipher, key));
-    qDebug()<<"change"<<cipher<<lic3.toDebugString()<<cipher.size();
+    if (lic3.fromBinaryV3(ShortCrypto::decryptRaw(cipher, key))) {
+        qDebug() << "V3鑷閫氳繃:" << lic3.toDebugStringV3();
+    } else {
+        qWarning() << "V3鑷澶辫触";
+    }
+
     //鏇存柊licenseinfo锛屽彧闇�瑕佹洿鏂癓icensedDuration_end銆丩icensedDuration_start銆丄ctiveState
     licenseinfo.LicensedDuration_end = newlicensedate.toString("yyyy-MM-dd");
     licenseinfo.LicensedDuration_start = licensedate.toString("yyyy-MM-dd");
@@ -791,7 +795,7 @@
 //    ui->textEdit_licensekey->setPlainText(getEncrypt(QString(testid),key));
 
     lic2.productId = ui->lineEdit_setproid->text().toUInt();
-    QString cipher = ShortCrypto::encrypt(lic2.toBinary(), key);
+    QString cipher = ShortCrypto::encryptRaw(lic2.toBinaryV3(key), key);
     ui->textEdit_licensekey->setPlainText(cipher);
 //    setLicenseinfo(licensekey_Obj);
 
@@ -817,7 +821,7 @@
     QString version = ui->lineEdit_setversion->text();
     lic2.verMajor = version.split(".").at(0).toUInt();
     lic2.verMinor = version.split(".").at(1).toUInt();
-    QString cipher = ShortCrypto::encrypt(lic2.toBinary(), key);
+    QString cipher = ShortCrypto::encryptRaw(lic2.toBinaryV3(key), key);
     ui->textEdit_licensekey->setPlainText(cipher);
     //閫欒!涔熷彧闇�瑕佹洿鏂癡ersionid
     licenseinfo.Versionid = ui->lineEdit_setversion->text();

--
Gitblit v1.9.1