* @brief Restores and re-verifies a stored certificate on startup; a failed restore * only drops the in-memory activation, never the stored blob, so a transient * fingerprint or clock glitch cannot destroy a certificate that may still be valid. */
| 271 | * fingerprint or clock glitch cannot destroy a certificate that may still be valid. |
| 272 | */ |
| 273 | void Licensing::OfflineLicense::readSettings() |
| 274 | { |
| 275 | m_settings.beginGroup("offlineLicense"); |
| 276 | const auto stored = m_settings.value("cert", "").toString(); |
| 277 | m_settings.endGroup(); |
| 278 | |
| 279 | if (stored.isEmpty()) |
| 280 | return; |
| 281 | |
| 282 | const auto framed = m_simpleCrypt.decryptToByteArray(stored); |
| 283 | if (framed.isEmpty()) |
| 284 | m_lastError = tr("The stored certificate could not be decrypted on this machine."); |
| 285 | else if (applyCertificate(framed, false)) |
| 286 | return; |
| 287 | |
| 288 | qWarning() << "[OfflineLicense] stored certificate not restored:" << m_lastError; |
| 289 | resetActivationState(); |
| 290 | } |
| 291 | |
| 292 | /** |
| 293 | * @brief Persists the verified certificate, encrypted, for the next launch. |
nothing calls this directly
no test coverage detected