[CSE] Store the sharing keys in memory

This commit is contained in:
Tomaz Canabrava 2017-12-20 19:37:04 +01:00
parent fc73ad7476
commit 0347cf4e9e
2 changed files with 12 additions and 2 deletions

View file

@ -1149,9 +1149,18 @@ void FolderMetadata::setupExistingMetadata()
// Cool, We actually have the key, we can decrypt the rest of the metadata.
qDebug() << "Sharing: " << sharing;
QByteArray sharingDecrypted = decryptJsonObject(sharing, _metadataKeys.last());
auto sharingDecrypted = QByteArray::fromBase64(decryptJsonObject(sharing, _metadataKeys.last()));
qDebug() << "Sharing Decrypted" << sharingDecrypted;
qDebug() << "Sharing B64 Decrypted" << QByteArray::fromBase64(sharingDecrypted);
//Sharing is also a JSON object, so extract it and populate.
auto sharingDoc = QJsonDocument::fromJson(sharingDecrypted);
auto sharingObj = sharingDoc.object();
for (auto it = sharingObj.constBegin(), end = sharingObj.constEnd(); it != end; it++) {
_sharing.push_back({it.key(), it.value().toString()});
}
// Retrieve the stored files, right now the metadata produced by this client doesn't have files, we should append one.
// TODO: Parse the "files" part.
}
// RSA/ECB/OAEPWithSHA-256AndMGF1Padding using private / public key.

View file

@ -118,6 +118,7 @@ private:
QVector<QByteArray> _metadataKeys;
AccountPtr _account;
QByteArray _metadata;
QVector<QPair<QString, QString>> _sharing;
};
class FileEncryptionJob : public QObject