From a9eb746e1ad16dc040916316a87e4ebb44261c37 Mon Sep 17 00:00:00 2001
From: ccy <3140717620@qq.com>
Date: 星期五, 23 十月 2026 14:56:43 +0800
Subject: [PATCH] 修正一下加密解密与主程序统一的问题
---
mainwindow.cpp | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 1292e42..6eb330e 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");
@@ -644,7 +648,7 @@
//灏濊瘯鏂扮殑鍔犲瘑鏂规硶
LicenseData lic;
- lic.boardUuid = LicenseData::hexStringToBinary(localinfo.Baseboard_Uuid);
+ lic.boardUuid = LicenseData::uuidStringToBinary(localinfo.Baseboard_Uuid);
lic.cpuSerial = LicenseData::hexStringToBinary(localinfo.CPU_Processorid);
lic.userName = localinfo.Username;
lic.expireDate = QDate::fromString(localinfo.LicensedDuration_end,"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