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

Method readInformation

app/src/Licensing/MachineID.cpp:319–349  ·  view source on GitHub ↗

* @brief Collects system data to derive the machine id and encryption key; a * healthy platform read refreshes the last-good store, a degraded read reuses * the stored fingerprint so a transient tool failure never re-keys the machine. */

Source from the content-addressed store, hash-verified

317 * the stored fingerprint so a transient tool failure never re-keys the machine.
318 */
319void Licensing::MachineID::readInformation()
320{
321 QString os;
322 bool complete = false;
323 QString id = readPlatformId(os, complete);
324
325 if (complete)
326 saveLastGoodRawId(id, os);
327
328 else {
329 const auto stored = loadLastGoodRawId(os);
330 if (!stored.isEmpty()) {
331 qWarning() << "[MachineID] degraded read; reusing last-good fingerprint";
332 id = stored;
333 }
334
335 else
336 qWarning() << "[MachineID] degraded read and no stored fingerprint";
337 }
338
339 auto data = QString("%1@%2:%3").arg(qApp->applicationName(), id, os);
340 auto hash = QCryptographicHash::hash(data.toUtf8(), QCryptographicHash::Blake2s_128);
341
342 m_machineId = QString::fromUtf8(hash.toBase64());
343 m_machineSpecificKey = qFromBigEndian<quint64>(hash.left(8));
344
345 auto appVerData =
346 QString("%1_%2@%3:%4").arg(qApp->applicationName(), qApp->applicationVersion(), id, os);
347 auto appVerHash = QCryptographicHash::hash(appVerData.toUtf8(), QCryptographicHash::Blake2s_128);
348 m_appVerMachineId = QString::fromUtf8(appVerHash.toBase64());
349}

Callers

nothing calls this directly

Calls 2

readPlatformIdFunction · 0.85
isEmptyMethod · 0.80

Tested by

no test coverage detected