MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / readSettings

Method readSettings

app/src/Licensing/OfflineLicense.cpp:273–290  ·  view source on GitHub ↗

* @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. */

Source from the content-addressed store, hash-verified

271 * fingerprint or clock glitch cannot destroy a certificate that may still be valid.
272 */
273void 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.

Callers

nothing calls this directly

Calls 3

isEmptyMethod · 0.80
decryptToByteArrayMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected