INNER CODE UNIT · C++
signLength
QuasarApp/Qt-Secret · src/Qt-RSA/qrsaencryption.cpp:389
auto signLength = rawData.length() - signStartPos - signMarkerLength * 2;
// message, that was recieved from channel
QByteArray message = rawData.left(signStartPos);
// hash, that was decrypt from recieved signature
QByteArray recievedHash = decode(QByteArray::fromHex(rawData.mid(signStartPos + signMarkerLength, signLength)),
pubKey, BlockSize::OneByte);
// if recievedHash == hashAlgorithm(recived message), then signed message is valid
return recievedHash == QCryptographicHash::hash(message, HashAlgorithm::Sha256);
}
bool QRSAEncryption::save(const QString &file, const QByteArray& key) {
QFile keyFile(file);
if (keyFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {