Check for target user before trying to decrypt a file

This commit is contained in:
Grégory Soutadé 2023-01-05 21:26:05 +01:00
parent ffd2004cbb
commit 34216d1b6e

View File

@ -1035,13 +1035,13 @@ namespace gourou
std::string user = extractTextElem(rightsDoc, "/adept:rights/licenseToken/user"); std::string user = extractTextElem(rightsDoc, "/adept:rights/licenseToken/user");
if (!encryptionKey)
{
if (this->user->getUUID() != user) if (this->user->getUUID() != user)
{ {
EXCEPTION(DRM_INVALID_USER, "This book has been downloaded for another user (" << user << ")"); EXCEPTION(DRM_INVALID_USER, "This book has been downloaded for another user (" << user << ")");
} }
if (!encryptionKey)
{
std::string encryptedKey = extractTextElem(rightsDoc, "/adept:rights/licenseToken/encryptedKey"); std::string encryptedKey = extractTextElem(rightsDoc, "/adept:rights/licenseToken/encryptedKey");
std::string keyType = extractTextAttribute(rightsDoc, "/adept:rights/licenseToken/encryptedKey", "keyType", false); std::string keyType = extractTextAttribute(rightsDoc, "/adept:rights/licenseToken/encryptedKey", "keyType", false);