| | |
| | | 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); |
| | |
| | | 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,只需要更新LicensedDuration_end、LicensedDuration_start、ActiveState |
| | | licenseinfo.LicensedDuration_end = newlicensedate.toString("yyyy-MM-dd"); |
| | | licenseinfo.LicensedDuration_start = licensedate.toString("yyyy-MM-dd"); |
| | |
| | | // 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); |
| | | |
| | |
| | | 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); |
| | | //這裡也只需要更新Versionid |
| | | licenseinfo.Versionid = ui->lineEdit_setversion->text(); |