Compare commits

...

10 Commits

6 changed files with 68 additions and 35 deletions

View File

@ -1,16 +1,16 @@
Introduction Introduction
------------ ------------
libgourou is a free implementation of Adobe's ADEPT protocol used to add DRM on ePub/PDF files. It overcome the lacks of Adobe support for Linux platforms. libgourou is a free implementation of Adobe's ADEPT protocol used to add DRM on ePub/PDF files. It overcomes the lack of Adobe support for Linux platforms.
Architecture Architecture
------------ ------------
Like RMSDK, libgourou has a client/server scheme. All platform specific functions (crypto, network...) has to be implemented in a client class (that derives from DRMProcessorClient) while server implements ADEPT protocol. Like RMSDK, libgourou has a client/server scheme. All platform specific functions (crypto, network...) have to be implemented in a client class (that derives from DRMProcessorClient) while server implements ADEPT protocol.
A reference implementation using cURL, OpenSSL and libzip is provided (in _utils_ directory). A reference implementation using cURL, OpenSSL and libzip is provided (in _utils_ directory).
Main fucntions to use from gourou::DRMProcessor are : Main functions to use from gourou::DRMProcessor are:
* Get an ePub from an ACSM file : _fulfill()_ and _download()_ * Get an ePub from an ACSM file : _fulfill()_ and _download()_
* Create a new device : _createDRMProcessor()_ * Create a new device : _createDRMProcessor()_
@ -18,32 +18,32 @@ Main fucntions to use from gourou::DRMProcessor are :
* Remove DRM : _removeDRM()_ * Remove DRM : _removeDRM()_
* Return loaned book : _returnLoan()_ * Return loaned book : _returnLoan()_
You can import configuration from (at least) : You can import configuration from (at least):
* Kobo device : .adept/device.xml, .adept/devicesalt and .adept/activation.xml * Kobo device : .adept/device.xml, .adept/devicesalt and .adept/activation.xml
* Bookeen device : .adobe-digital-editions/device.xml, root/devkey.bin and .adobe-digital-editions/activation.xml * Bookeen device : .adobe-digital-editions/device.xml, root/devkey.bin and .adobe-digital-editions/activation.xml
Or create a new one. Be careful : there is a limited number of devices that can be created bye one account. Or create a new one. Be careful: there is a limited number of devices that can be created by one account.
ePub are encrypted using a shared key : one account / multiple devices, so you can create and register a device into your computer and read downloaded (and encrypted) ePub file with your eReader configured using the same AdobeID account. ePub are encrypted using a shared key: one account / multiple devices, so you can create and register a device into your computer and read downloaded (and encrypted) ePub file with your eReader configured using the same AdobeID account.
For those who wants to remove DRM without adept_remove, you can export your private key and import it within [Calibre](https://calibre-ebook.com/) an its DeDRM plugin. For those who want to remove DRM without adept_remove, you can export your private key and import it within [Calibre](https://calibre-ebook.com/) an its DeDRM plugin.
Dependencies Dependencies
------------ ------------
For libgourou : For libgourou:
_externals_ : _externals_ :
* libpugixml * libpugixml
_internals_ : _internals_:
* uPDFParser * uPDFParser
For utils : For utils:
* libcurl * libcurl
* OpenSSL * OpenSSL
@ -52,7 +52,7 @@ For utils :
Internal libraries are automatically fetched and statically compiled during the first run. Internal libraries are automatically fetched and statically compiled during the first run.
When you update libgourou's repository, **don't forget to update internal libraries** with : When you update libgourou's repository, **don't forget to update internal libraries** with:
make update_lib make update_lib
@ -92,31 +92,31 @@ You can optionaly specify your .adept directory
export ADEPT_DIR=/home/XXX export ADEPT_DIR=/home/XXX
Then, use utils as following : Then, use utils as following:
You can import configuration from your eReader or create a new one with _utils/adept\_activate_ : You can import configuration from your eReader or create a new one with _utils/adept\_activate_:
./utils/adept_activate -u <AdobeID USERNAME> ./utils/adept_activate -u <AdobeID USERNAME>
Then a _/home/<user>/.config/adept_ directory is created with all configuration file Then a _/home/<user>/.config/adept_ directory is created with all configuration file
To download an ePub/PDF : To download an ePub/PDF:
./utils/acsmdownloader <ACSM_FILE> ./utils/acsmdownloader <ACSM_FILE>
To export your private key (for DeDRM software) : To export your private key (for DeDRM software):
./utils/acsmdownloader --export-private-key [-o adobekey_1.der] ./utils/acsmdownloader --export-private-key [-o adobekey_1.der]
To remove ADEPT DRM : To remove ADEPT DRM:
./utils/adept_remove <encryptedFile> ./utils/adept_remove <encryptedFile>
To list loaned books : To list loaned books:
./utils/adept_loan_mgt [-l] ./utils/adept_loan_mgt [-l]
To return a loaned book : To return a loaned book:
./utils/adept_loan_mgt -r <id> ./utils/adept_loan_mgt -r <id>
@ -150,3 +150,17 @@ Special thanks
* _Jens_ for all test samples and utils testing * _Jens_ for all test samples and utils testing
* _Milian_ for debug & code * _Milian_ for debug & code
* _Berwyn H_ for all test samples, feedbacks, patches and kind donation * _Berwyn H_ for all test samples, feedbacks, patches and kind donation
Donation
--------
https://www.paypal.com/donate/?hosted_button_id=JD3U6XMZCPHKN
Donators
--------
* _Berwyn H_
* _bwitt_
* _Ismail_

View File

@ -37,7 +37,7 @@
#define ACS_SERVER "http://adeactivate.adobe.com/adept" #define ACS_SERVER "http://adeactivate.adobe.com/adept"
#endif #endif
#define LIBGOUROU_VERSION "0.8.3" #define LIBGOUROU_VERSION "0.8.6"
namespace gourou namespace gourou
{ {

View File

@ -3,7 +3,7 @@
if [ ! -d lib/updfparser ] ; then if [ ! -d lib/updfparser ] ; then
echo "Some libraries are missing" echo "Some libraries are missing"
echo "You must run this script at the top of libgourou working direcotry." echo "You must run this script at the top of libgourou working direcotry."
echo "./lib/setup.sh must be called first (make all)" echo "./scripts/setup.sh must be called first (make all)"
exit 1 exit 1
fi fi

View File

@ -859,14 +859,21 @@ namespace gourou
std::string DRMProcessor::getDefaultAdeptDir(void) std::string DRMProcessor::getDefaultAdeptDir(void)
{ {
#ifndef DEFAULT_ADEPT_DIR #ifndef DEFAULT_ADEPT_DIR
const char* user = getenv("USER"); const char* home = getenv("HOME");
if (user && user[0]) if (home)
{ return home + std::string("/.config/adept/");
return std::string("/home/") + user + std::string("/.config/adept/"); else
} {
else const char* user = getenv("USER");
return LOCAL_ADEPT_DIR;
if (user && user[0])
{
return std::string("/home/") + user + std::string("/.config/adept/");
}
else
return LOCAL_ADEPT_DIR;
}
#else #else
return DEFAULT_ADEPT_DIR "/"; return DEFAULT_ADEPT_DIR "/";
#endif #endif
@ -1317,6 +1324,7 @@ namespace gourou
std::vector<uPDFParser::Object*> objects = parser.objects(); std::vector<uPDFParser::Object*> objects = parser.objects();
std::vector<uPDFParser::Object*>::iterator it; std::vector<uPDFParser::Object*>::iterator it;
std::vector<uPDFParser::Object*>::reverse_iterator rIt; std::vector<uPDFParser::Object*>::reverse_iterator rIt;
std::vector<uPDFParser::Object*> ebxObjects;
unsigned char decryptedKey[16]; unsigned char decryptedKey[16];
int ebxId; int ebxId;
@ -1375,7 +1383,7 @@ namespace gourou
if (object->objectId() == ebxId) if (object->objectId() == ebxId)
{ {
// object->deleteKey("Filter"); ebxObjects.push_back(object);
continue; continue;
} }
@ -1485,6 +1493,9 @@ namespace gourou
} }
} }
for(it = ebxObjects.begin(); it != ebxObjects.end(); it++)
parser.removeObject(*it);
uPDFParser::Object& trailer = parser.getTrailer(); uPDFParser::Object& trailer = parser.getTrailer();
trailer.deleteKey("Encrypt"); trailer.deleteKey("Encrypt");

View File

@ -229,7 +229,12 @@ private:
maxSizeBookName = loan->bookName.size(); maxSizeBookName = loan->bookName.size();
} }
if (maxSizeBookName > MAX_SIZE_BOOK_NAME) /* Manage empty names */
if (maxSizeBookName == 0)
maxSizeBookName = sizeof("No name ")-1;
else if (maxSizeBookName < 4)
maxSizeBookName = 4;
else if (maxSizeBookName > MAX_SIZE_BOOK_NAME)
maxSizeBookName = MAX_SIZE_BOOK_NAME; maxSizeBookName = MAX_SIZE_BOOK_NAME;
else if ((maxSizeBookName % 2)) else if ((maxSizeBookName % 2))
maxSizeBookName++; maxSizeBookName++;
@ -276,7 +281,9 @@ private:
std::cout << kv.first; std::cout << kv.first;
std::cout << " "; std::cout << " ";
if (loan->bookName.size() > MAX_SIZE_BOOK_NAME) if (loan->bookName.size() == 0)
bookName = std::string("No name ");
else if (loan->bookName.size() > MAX_SIZE_BOOK_NAME)
bookName = std::string(loan->bookName.c_str(), MAX_SIZE_BOOK_NAME); bookName = std::string(loan->bookName.c_str(), MAX_SIZE_BOOK_NAME);
else else
bookName = loan->bookName; bookName = loan->bookName;

View File

@ -298,14 +298,15 @@ std::string DRMProcessorClientImpl::sendHTTPRequest(const std::string& URL, cons
} }
curl_slist_free_all(list); curl_slist_free_all(list);
long http_code = 400;
curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_code);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
if (res != CURLE_OK) if (res != CURLE_OK)
EXCEPTION(gourou::CLIENT_NETWORK_ERROR, "Error " << curl_easy_strerror(res)); EXCEPTION(gourou::CLIENT_NETWORK_ERROR, "Error " << curl_easy_strerror(res));
long http_code = 400;
curl_easy_getinfo (curl, CURLINFO_RESPONSE_CODE, &http_code);
if (http_code >= 400) if (http_code >= 400)
EXCEPTION(gourou::CLIENT_HTTP_ERROR, "HTTP Error code " << http_code); EXCEPTION(gourou::CLIENT_HTTP_ERROR, "HTTP Error code " << http_code);