Libgourou

Libgourou Commit Details

Date:2022-12-21 21:06:03 (9 months 1 day ago)
Author:Grégory Soutadé
Branch:master
Commit:f65e8cd9ebcb78ba232eb6b3cf6b3bd1b72a8c9c
Parents: 24bae89095f5ad12dfa516d114ed2058e874a74c
Message:Check for target user before trying to decrypt a file

Changes:
Minclude/libgourou_common.h (1 diff)
Msrc/libgourou.cpp (2 diffs)

File differences

include/libgourou_common.h
129129
130130
131131
132
132
133
133134
134135
135136
DRM_IN_OUT_EQUALS,
DRM_MISSING_PARAMETER,
DRM_INVALID_KEY_SIZE,
DRM_ERR_ENCRYPTION_KEY_FP
DRM_ERR_ENCRYPTION_KEY_FP,
DRM_INVALID_USER
};
#ifndef _NOEXCEPT
src/libgourou.cpp
10281028
10291029
10301030
1031
1032
1033
1034
1035
1036
1037
10311038
10321039
10331040
......
10411048
10421049
10431050
1044
1051
10451052
10461053
10471054
{
unsigned char rsaKey[RSA_KEY_SIZE];
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)
{
std::string encryptedKey = extractTextElem(rightsDoc, "/adept:rights/licenseToken/encryptedKey");
ByteArray arrayEncryptedKey = ByteArray::fromBase64(encryptedKey);
std::string privateKeyData = user->getPrivateLicenseKey();
std::string privateKeyData = this->user->getPrivateLicenseKey();
ByteArray privateRSAKey = ByteArray::fromBase64(privateKeyData);
dumpBuffer(gourou::LG_LOG_DEBUG, "To decrypt : ", arrayEncryptedKey.data(), arrayEncryptedKey.length());

Archive Download the corresponding diff file