From 34216d1b6e38a2119891a446cd08889380bd8a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Thu, 5 Jan 2023 21:26:05 +0100 Subject: [PATCH] Check for target user before trying to decrypt a file --- src/libgourou.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libgourou.cpp b/src/libgourou.cpp index 7341fe9..cdf3848 100644 --- a/src/libgourou.cpp +++ b/src/libgourou.cpp @@ -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);