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
1 changed files with 5 additions and 5 deletions

View File

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