Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "hardened" Adobe DRM & crypto code clean-up #48

Merged
merged 2 commits into from
Mar 18, 2022

Conversation

a980e066a01
Copy link

This PR adds support for the newer (""hardened"") Adobe DRM added with RMSDK 10.
It also cleans up the crypto code by removing support for anything but PyCryptodome and hashlib (faster than PyCryptodome). This actually fixes a few bugs on its own. You might want to review the two commits separately.

Closes #20, #25, #33, #45.

  • The second commits adds support for ""hardened"" Adobe DRM and updates the documentation accordingly. In a nutshell, this so-called "hardened DRM" is just another layer of encryption on the encrypted key, using info that's fully available in rights.xml
  • The first commit cleans up the crypto code and only retains support for PyCryptodome + hashlib, removing technical debt. I needed to do that to simplify "hardened" Adobe DRM support, but I figured that I could do that for the entire project: on Windows, openssl libs are most of the time not installed, and I think it's the same thing for Macs

I have tested my code on Amazon, ADE and Kobo DRMed books, but hopefully I haven't broken anything.

@j-howell
Copy link

j-howell commented Mar 4, 2022

Thank you. It looks like a lot of work went into that.

@PaulGJL

This comment was marked as resolved.

@ElleKayEm
Copy link

@PaulGJL You're using this patch on the newer Adobe DRM?

@choc96208
Copy link

@PaulGJL have you tried cloning this particular branch?

git clone https://github.com/a980e066a01/DeDRM_tools.git --branch patch-hardened-drm

then create a release with

./make_release.py

Source: How do I clone a single branch in Git?

@noDRM
Copy link
Owner

noDRM commented Mar 6, 2022

Wow, thanks a lot for the new Adobe DRM support. I wonder if this is going to cause yet another DMCA claim to this repository...

I am going to take a look at the code and see if it works.

Copy link
Owner

@noDRM noDRM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested your changes and I was able to remove the DRM from an ADE3.0+ book. Great!
Though, I did notice one typo in your code that breaks some stuff, and I'm wondering why you removed the verify_book_key function? That was added for a reason, and I'm not sure if your changes to the encryption code are sufficient to the point where that wouldn't be needed anymore. See apprenticeharper#1862 for details as to why this was added.

DeDRM_plugin/ignoblekeyGenPassHash.py Outdated Show resolved Hide resolved
DeDRM_plugin/ineptepub.py Show resolved Hide resolved
DeDRM_plugin/ineptepub.py Show resolved Hide resolved
DeDRM_plugin/ineptpdf.py Show resolved Hide resolved
@ElleKayEm ElleKayEm mentioned this pull request Mar 6, 2022
@johnhutnut
Copy link

i install it ,but fail calibre, version 5.38.0
错误: 未处理的异常: ModuleNotFoundError:No module named '__version'

calibre 5.38 [64bit] embedded-python: True is64bit: True
Windows-10-10.0.22000 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22000')
Python 3.8.5
Windows: ('10', '10.0.22000', '', 'Multiprocessor Free')
Interface language: zh_CN
Successfully initialized third party plugins: DeDRM (10, 0, 2) && Obok DeDRM (10, 0, 0)
Traceback (most recent call last):
File "calibre\gui2\preferences\plugins.py", line 326, in add_plugin
File "calibre\customize\ui.py", line 476, in add_plugin
File "calibre\customize\ui.py", line 64, in load_plugin
File "calibre\customize\zipplugin.py", line 290, in load
File "polyglot\builtins.py", line 123, in reload
File "importlib_init_.py", line 169, in reload
File "", line 604, in _exec
File "calibre\customize\zipplugin.py", line 191, in exec_module
File "calibre_plugins.dedrm.init", line 97, in
ModuleNotFoundError: No module named '__version'

@ElleKayEm
Copy link

@johnhutnut
Looks like the plugin (with this patch) is not getting loaded?

@noDRM
Copy link
Owner

noDRM commented Mar 6, 2022

@johnhutnut You are trying to load the plugin from source code - that's not supported. If you want to run versions that aren't released yet, use the make_release.py script to generate the proper archive.

@johnhutnut
Copy link

johnhutnut commented Mar 6, 2022 via email

@johnhutnut
Copy link

@johnhutnut You are trying to load the plugin from source code - that's not supported. If you want to run versions that aren't released yet, use the make_release.py script to generate the proper archive.

can you make a update version for me

@noDRM
Copy link
Owner

noDRM commented Mar 6, 2022

I'm not going to create a release with untested code. Once the review of this PR is finished, the PR has been merged and the rest of the code is cleaned up a bit, there will be a new release.

@johnhutnut
Copy link

johnhutnut commented Mar 6, 2022 via email

@johnhutnut
Copy link

johnhutnut commented Mar 6, 2022 via email

@ElleKayEm
Copy link

i am doctor ,not a programer 获取 Outlook for iOShttps://aka.ms/o0ukef

________________________________ 发件人: noDRM @.> 发送时间: Monday, March 7, 2022 12:06:51 AM 收件人: noDRM/DeDRM_tools @.> 抄送: johnhutnut @.>; Mention @.> 主题: Re: [noDRM/DeDRM_tools] Add support for "hardened" Adobe DRM & crypto code clean-up (PR #48) I'm not going to create a release with untested code. Once the review of this PR is finished, the PR has been merged and the rest of the code is cleaned up a bit, there will be a new release. ― Reply to this email directly, view it on GitHub<#48 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AYC7MY4LCPS4TEVGBVURKH3U6TJZXANCNFSM5PVCQRHQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you were mentioned.Message ID: @.***>

Then you're better off waiting for the next release.

@DarthSaddest
Copy link

i don't know how to generate the achive ,can you package one archive for ,thank you so much

Install the zip from https://we.tl/t-bNCKVOTyNx as a plugin. Do NOT extract anything. [Dislcaimer: Verify_key functions are absent and you might have issues.]

@johnhutnut
Copy link

Install the zip from https://we.tl/t-bNCKVOTyNx as a plugin. Do NOT extract anything. [Dislcaimer: Verify_key functions are absent and you might have issues.]

thanks a lot ,work fine

@tvphanatic
Copy link

Install the zip from https://we.tl/t-bNCKVOTyNx as a plugin. Do NOT extract anything. [Dislcaimer: Verify_key functions are absent and you might have issues.]

thanks a lot ,work fine

I just tried this with two ProQuest ebooks downloaded today, and it worked great on both; thanks!

@PaulGJL
Copy link

PaulGJL commented Mar 9, 2022

Hi, so this patch does work for most ADE books now, but it has failed with a particular book. Seems like there's a problem with the code? Please check, thanks.

DeDRM v10.0.2: Trying to decrypt The New Zealand Bill of Rights Act.pdf
[37.58] splash screen hidden
[37.58] Started up in 37.58 seconds with 12 books
stdout+stderr from file dialog helper: [b'', b'']
piped data from file dialog helper: [b'\xc3\x9d\xa9\xa87\xb3\xfbe\xb6\xcb;[\xa9S\xde\xdd\xa4\x11^\xadC8\xe6\xf3\xd1Q\x87\xdb\xae\x08E\xc6', b'C:\Users\tgots\Documents\My Digital Editions\The New Zealand Bill of Rights Act.pdf']
DeDRM v10.0.2: The New Zealand Bill of Rights Act.pdf is a PDF ebook with encryption EBX_HANDLER
DeDRM v10.0.2: The New Zealand Bill of Rights Act.pdf is a PDF ebook (EBX) for UUID 86029e8d-c7be-4607-949c-fd6098c3aadf
DeDRM v10.0.2: Trying encryption key default_key
error writing pdf: Invalid object number: objid=13803
Traceback (most recent call last):
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 1804, in getobj
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 2274, in decryptBook
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 2102, in dump
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 1806, in getobj
ineptpdf.PDFSyntaxError: Invalid object number: objid=13803
DeDRM v10.0.2: Failed to decrypt with key default_key after 7.5 seconds
DeDRM v10.0.2: Looking for new default Adobe Digital Editions Keys after 7.5 seconds
Found 1 keys
DeDRM v10.0.2: Trying a new default key
error writing pdf: Invalid object number: objid=13803
Traceback (most recent call last):
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 1804, in getobj
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 2274, in decryptBook
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 2102, in dump
File "C:\Users\tgots\AppData\Roaming\calibre\plugins\DeDRM.zip\ineptpdf.py", line 1806, in getobj
ineptpdf.PDFSyntaxError: Invalid object number: objid=13803
DeDRM v10.0.2: Failed to decrypt with new default key after 11.7 seconds
DeDRM v10.0.2: Finished after 11.7 seconds
Traceback (most recent call last):
File "calibre\customize\ui.py", line 428, in get_file_type_metadata
File "calibre\customize\builtins.py", line 347, in get_metadata
File "calibre\ebooks\metadata\pdf.py", line 126, in get_metadata
ValueError: Could not read info dict from PDF
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler

pdfinfo errored out with return code: 1

@kokowang8910
Copy link

Thanks a lot for the effort. it works! awesome!

Install the zip from https://we.tl/t-bNCKVOTyNx as a plugin. Do NOT extract anything. [Dislcaimer: Verify_key functions are absent and you might have issues.]

@usure
Copy link

usure commented Mar 10, 2022

i don't know how to generate the achive ,can you package one archive for ,thank you so much

Install the zip from https://we.tl/t-bNCKVOTyNx as a plugin. Do NOT extract anything. [Dislcaimer: Verify_key functions are absent and you might have issues.]

Doesn't seem to work for me. I'm on Windows 7 and using a Calibre version prior to 5.38.0 -- might that be the problem?

@ElleKayEm
Copy link

@usure
If it's calibre before 5.x, then that's probably it.

@usure
Copy link

usure commented Mar 10, 2022

@usure If it's calibre before 5.x, then that's probably it.

Thanks. Makes sense. Will try on my Win 8 laptop.

@noDRM
Copy link
Owner

noDRM commented Mar 11, 2022

The goal is for this plugin to work with Calibre 4.x, too, at least for the most common DRM (Adobe). If it doesn't, can you post a debug log?

@boan-anbo
Copy link

@a980e066a01 Thanks so much. It works for me as well

@ableeker
Copy link

I've implemented these changes, and I've tried to convert some ebooks. Most worked, but the B&N ebooks I have didn't.

I had a look at the new code, and I noticed that the book key that had been decrypted by this new code was 32 bytes long, while the bookkey from the current code was 16 bytes long. I noticed that the current code checks if the book key is longer than 16 bytes, and if that's the case, it only uses the last 16 bytes. This code has been omitted, but still seems needed, at least to convert the ebooks I have. Actually, this check is only needed if the book key can be shorter than 16 bytes, but maybe that doesn't happen anyway. In that case it may suffice to cut the extra bytes.

If the book key always is 16 bytes, or longer, the correct book key can be generated by changing the line:

bookkey = unpad(AES.new(key, AES.MODE_CBC, b'\x00'*16).decrypt(bookkey), 16)

to:

bookkey = unpad(AES.new(key, AES.MODE_CBC, b'\x00'*16).decrypt(bookkey), 16)[-16:]

If the book key can be shorter than 16 bytes, this line doesn't have to be modified, and the following lines from the current code should be placed after the line:

if len(bookkey) > 16:
    bookkey = bookkey[-16:]

When the new code is modified this way, my B&N ebooks convert successfully.

@a980e066a01
Copy link
Author

Thanks for letting me know...

Can you remove the unpad and print hexlify(bookkey) for these books please?

@ableeker
Copy link

One ebook has book key:

b'\xa0"?\xb3YN\xea\x12\x9c\xb1\xbe\x00c\xa8V\xed\xbe,Uz4\xb7\xa9\xe6p\xeb\x83\x8c\xe8\r\xd2H\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10'
b'a0223fb3594eea129cb1be0063a856edbe2c557a34b7a9e670eb838ce80dd24810101010101010101010101010101010'

The other ebook has book key:

b'\x06\x19\xb2<pD\xdb\xba\xbfgM\xf6"@\xb3_|\x1f\xc7x]I<\xc5\x1d\x84\xee\x9e>\xd3Y0\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10\x10'
b'0619b23c7044dbbabf674df62240b35f7c1fc7785d493cc51d84ee9e3ed3593010101010101010101010101010101010'

The book key needed to convert the first ebook is:

b'\xbe,Uz4\xb7\xa9\xe6p\xeb\x83\x8c\xe8\r\xd2H'
b'be2c557a34b7a9e670eb838ce80dd248'

The book key needed to convert the second ebook is:
b'|\x1f\xc7x]I<\xc5\x1d\x84\xee\x9e>\xd3Y0'
b'7c1fc7785d493cc51d84ee9e3ed35930'

@JSWolf
Copy link

JSWolf commented Mar 31, 2022

Install the zip from https://we.tl/t-bNCKVOTyNx as a plugin. Do NOT extract anything. [Dislcaimer: Verify_key functions are absent and you might have issues.]

thanks a lot ,work fine

Can tyou please post again? The upload has since expired. Thanks.

@ElleKayEm
Copy link

@JSWolf If you don't want to run makerelease.py yourself, the one noDRM posted in this comment is more recent: #48 (comment)

@x0thrmc-exe
Copy link

I have been struggling with DRM on a single ebook for over a week now.
Calibre: 5.41 in Win10 VM with ADE 4.5 installed. and Calibre 5.25 in Linux, also tried on OSX
DeDRM: 10.0.2 beta from 2022-03-18

I have been successful with every other PDF and EPUB from multiple sources. Also tried many from the same source as the problem ebook. I only have an error on this PDF so I can not figure out what the issue is.

Failed to convert book: C:\Users*redacted my name*\Calibre Library\Unknown*redacted book name*(8)*redacted book name*- Unknown.pdf with error:
DeDRM v10.0.2: Trying to decrypt redacted book name- Unknown.pdf
DeDRM v10.0.2: redacted book name- Unknown.pdf is a PDF ebook with encryption EBX_HANDLER
DeDRM v10.0.2: redacted book name- Unknown.pdf is a PDF ebook (EBX) for UUID 1d72bb29-b23b-4659-b640-439a56124aec
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler

pdfinfo errored out with return code: 1
InputFormatPlugin: PDF Input running
on C:\Users*redacted my name*\Calibre Library\Unknown*redacted book name*(8)*redacted book name*- Unknown.pdf
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Traceback (most recent call last):
File "calibre\customize\ui.py", line 432, in get_file_type_metadata
File "calibre\customize\builtins.py", line 323, in get_metadata
File "calibre\ebooks\metadata\pdf.py", line 124, in get_metadata
ValueError: Could not read info dict from PDF
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
File "encodings\hex_codec.py", line 19, in hex_decode
ValueError: string argument should contain only ASCII characters

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "calibre\customize\ui.py", line 175, in _run_filetype_plugins
File "calibre_plugins.dedrm.init", line 1050, in run
File "calibre_plugins.dedrm.init", line 917, in PDFDecrypt
File "calibre_plugins.dedrm.init", line 689, in PDFIneptDecrypt
ValueError: decoding with 'hex' codec failed (ValueError: string argument should contain only ASCII characters)
Traceback (most recent call last):
File "runpy.py", line 194, in _run_module_as_main
File "runpy.py", line 87, in _run_code
File "site.py", line 82, in
File "site.py", line 77, in main
File "site.py", line 49, in run_entry_point
File "calibre\utils\ipc\worker.py", line 196, in main
File "", line 1, in
File "calibre\srv\render_book.py", line 823, in viewer_main
File "calibre\srv\render_book.py", line 814, in render_for_viewer
File "calibre\srv\render_book.py", line 791, in render
File "calibre\ebooks\oeb\iterator\book.py", line 62, in extract_book
File "calibre\customize\conversion.py", line 242, in call
File "calibre\ebooks\conversion\plugins\pdf_input.py", line 51, in convert
File "calibre\ebooks\pdf\pdftohtml.py", line 82, in pdftohtml
calibre.ebooks.ConversionError: pdftohtml failed with return code: 1
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler

@ElleKayEm
Copy link

@x0thrmc-exe You've tried with the current code (including what was merged from this pull request)? Not just the last 10.0.2 release?

@x0thrmc-exe
Copy link

@x0thrmc-exe You've tried with the current code (including what was merged from this pull request)? Not just the last 10.0.2 release?

I am using the version from 2022-03-18 that was linked above in this thread. Is there a later one?

@ElleKayEm
Copy link

No, not unless you run makerelease.py yourself.

@x0thrmc-exe
Copy link

Ok I tried again.
I used the master from 14 days ago.
Ran makrerelease.py and added the new plugin.
I tried the same book again and got the same error.

@ElleKayEm
Copy link

Hopefully @noDRM or someone can take a look at your last log and figure something out.

@x0thrmc-exe
Copy link

Looking at other peoples error logs, I seem to be the only one that has anything like

ValueError: string argument should contain only ASCII characters

And I wonder if this could be due to the metadata of the book containing non-ASCII characters. It's a bilingual book with both Chinese and English. Although, all other similar books from the same source, author, and publisher have no problem.

@noDRM
Copy link
Owner

noDRM commented May 19, 2022

Looking at the error code, this is unlikely to be caused by the book name.
Do you get this error for multiple PDF books or just one? Or did you just test one?

This looks like the account key in the plugin settings is corrupted. Did you manually import that key, or did the plugin auto-discover it?
Can you try removing the ADE key from the plugin settings (make a backup first, just in case) and try again, see if it auto-discovers the correct one?

@x0thrmc-exe
Copy link

Looking at the error code, this is unlikely to be caused by the book name. Do you get this error for multiple PDF books or just one? Or did you just test one?

Only one book had this problem. All other books from the same source, including other books in the series had no problems at all.

This looks like the account key in the plugin settings is corrupted. Did you manually import that key, or did the plugin auto-discover it? Can you try removing the ADE key from the plugin settings (make a backup first, just in case) and try again, see if it auto-discovers the correct one?

I have tried both manually importing and auto-discovering, and on different platforms and computers. I have already tried removing and auto-discovering, but I will try once more.

@ElleKayEm
Copy link

So this book is tied to the same Adobe ID as the ones which successfully decrypt?

@x0thrmc-exe
Copy link

yes

So this book is tied to the same Adobe ID as the ones which successfully decrypt?

@ALonX1
Copy link

ALonX1 commented Jun 5, 2022

@maksimumeffort @dskfsdfksdfk Can you try this beta version, please. This should hopefully fix the bug with the V3-encrypted PDF files (but I can't test that myself as I don't have such a file), and it will add some more logging for that __version issue that hopefully helps me track this down.

DeDRM_tools_beta_2022-03-18.zip

Working fine on a ProQuest PDF tested today

@stillhope
Copy link

stillhope commented Jun 6, 2022

Hi, in [DeDRM_tools_beta_2022-03-18.zip] it appears the code can be run without calibre, standalone

in file standalone/init.py
says
"CLI interface for the DeDRM plugin (useable without Calibre, too)"

To run as a standalone, what command to I type in terminal? and do i need to be in a specific directory?
Thankyou for any help

@noDRM
Copy link
Owner

noDRM commented Jun 10, 2022

This has nothing to do with this PR...
Same as #87, running the plugin standalone isn't possible yet. I started implementing it which is what you see in that file, but support for that isn't complete yet.

@TheWranger
Copy link

Looking at other peoples error logs, I seem to be the only one that has anything like

ValueError: string argument should contain only ASCII characters

And I wonder if this could be due to the metadata of the book containing non-ASCII characters. It's a bilingual book with both Chinese and English. Although, all other similar books from the same source, author, and publisher have no problem.

Hey, I'm experiencing this error as well. I have a PDF from ProQuest I'm attempting to remove the DRM of, that won't download in ADE 2.0 so I have to use 4.5, and after attempting to use the new version of DeDRM linked at #48 (comment)

https://www.toptal.com/developers/hastebin/efufevujit.sql

@ht55ght55
Copy link

Ohh thank you, thank you!!! I almost gave up again.

@TheWranger
Copy link

Looking at other peoples error logs, I seem to be the only one that has anything like

ValueError: string argument should contain only ASCII characters

And I wonder if this could be due to the metadata of the book containing non-ASCII characters. It's a bilingual book with both Chinese and English. Although, all other similar books from the same source, author, and publisher have no problem.

Hey, I'm experiencing this error as well. I have a PDF from ProQuest I'm attempting to remove the DRM of, that won't download in ADE 2.0 so I have to use 4.5, and after attempting to use the new version of DeDRM linked at #48 (comment)

https://www.toptal.com/developers/hastebin/efufevujit.sql

Here is another book which is still blocked by DRM with the same error. This one was downloaded from the Internet Archive.
https://www.toptal.com/developers/hastebin/popubojoyi.sql

@TheWranger
Copy link

Looking at other peoples error logs, I seem to be the only one that has anything like

ValueError: string argument should contain only ASCII characters

And I wonder if this could be due to the metadata of the book containing non-ASCII characters. It's a bilingual book with both Chinese and English. Although, all other similar books from the same source, author, and publisher have no problem.

Hey, I'm experiencing this error as well. I have a PDF from ProQuest I'm attempting to remove the DRM of, that won't download in ADE 2.0 so I have to use 4.5, and after attempting to use the new version of DeDRM linked at #48 (comment)
https://www.toptal.com/developers/hastebin/efufevujit.sql

Here is another book which is still blocked by DRM with the same error. This one was downloaded from the Internet Archive. https://www.toptal.com/developers/hastebin/popubojoyi.sql

Looking at other peoples error logs, I seem to be the only one that has anything like

ValueError: string argument should contain only ASCII characters

And I wonder if this could be due to the metadata of the book containing non-ASCII characters. It's a bilingual book with both Chinese and English. Although, all other similar books from the same source, author, and publisher have no problem.

Hey, I'm experiencing this error as well. I have a PDF from ProQuest I'm attempting to remove the DRM of, that won't download in ADE 2.0 so I have to use 4.5, and after attempting to use the new version of DeDRM linked at #48 (comment)

https://www.toptal.com/developers/hastebin/efufevujit.sql

I have been struggling with DRM on a single ebook for over a week now. Calibre: 5.41 in Win10 VM with ADE 4.5 installed. and Calibre 5.25 in Linux, also tried on OSX DeDRM: 10.0.2 beta from 2022-03-18

I have been successful with every other PDF and EPUB from multiple sources. Also tried many from the same source as the problem ebook. I only have an error on this PDF so I can not figure out what the issue is.

Failed to convert book: C:\Usersredacted my name\Calibre Library\Unknownredacted book name(8)redacted book name- Unknown.pdf with error:
DeDRM v10.0.2: Trying to decrypt redacted book name- Unknown.pdf
DeDRM v10.0.2: redacted book name- Unknown.pdf is a PDF ebook with encryption EBX_HANDLER
DeDRM v10.0.2: redacted book name- Unknown.pdf is a PDF ebook (EBX) for UUID 1d72bb29-b23b-4659-b640-439a56124aec
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler
pdfinfo errored out with return code: 1
InputFormatPlugin: PDF Input running
on C:\Usersredacted my name\Calibre Library\Unknownredacted book name(8)redacted book name- Unknown.pdf
Failed to run pipe worker with command: from calibre.srv.render_book import viewer_main; viewer_main()
Traceback (most recent call last):
File "calibre\customize\ui.py", line 432, in get_file_type_metadata
File "calibre\customize\builtins.py", line 323, in get_metadata
File "calibre\ebooks\metadata\pdf.py", line 124, in get_metadata
ValueError: Could not read info dict from PDF
Running file type plugin DeDRM failed with traceback:
Traceback (most recent call last):
File "encodings\hex_codec.py", line 19, in hex_decode
ValueError: string argument should contain only ASCII characters
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "calibre\customize\ui.py", line 175, in _run_filetype_plugins
File "calibre_plugins.dedrm.init", line 1050, in run
File "calibre_plugins.dedrm.init", line 917, in PDFDecrypt
File "calibre_plugins.dedrm.init", line 689, in PDFIneptDecrypt
ValueError: decoding with 'hex' codec failed (ValueError: string argument should contain only ASCII characters)
Traceback (most recent call last):
File "runpy.py", line 194, in _run_module_as_main
File "runpy.py", line 87, in _run_code
File "site.py", line 82, in
File "site.py", line 77, in main
File "site.py", line 49, in run_entry_point
File "calibre\utils\ipc\worker.py", line 196, in main
File "", line 1, in
File "calibre\srv\render_book.py", line 823, in viewer_main
File "calibre\srv\render_book.py", line 814, in render_for_viewer
File "calibre\srv\render_book.py", line 791, in render
File "calibre\ebooks\oeb\iterator\book.py", line 62, in extract_book
File "calibre\customize\conversion.py", line 242, in call
File "calibre\ebooks\conversion\plugins\pdf_input.py", line 51, in convert
File "calibre\ebooks\pdf\pdftohtml.py", line 82, in pdftohtml
calibre.ebooks.ConversionError: pdftohtml failed with return code: 1
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler

Okay, I've solved it. You need to go into Calibre preferences, and go into the plugin's preferences and delete your Adobe Digital Editions key. It seems that if you add it yourself, you get this ascii error. If you try adding a DRM book but you don't have any keys added, the plugin will automatically do some automated search for the correct key (that will not give you an ascii error) and the DRM will be gone.

In other words, it's the "Create new Adobe Digital Editions Key" that is causing this ascii error; it's fetching some errored key. You just need to let the plugin sort itself out automatically.

@ElleKayEm
Copy link

@TheWranger Ok, was surprised you were having trouble with an Internet Archive book since as far as I'm aware they don't use (or at least don't exclusively use) the newer Adobe DRM.

@TheWranger
Copy link

@TheWranger Ok, was surprised you were having trouble with an Internet Archive book since as far as I'm aware they don't use (or at least don't exclusively use) the newer Adobe DRM.

It probably isn't, I just didn't get around to trying it with the old version of DE

@ElleKayEm
Copy link

@TheWranger Ok, was surprised you were having trouble with an Internet Archive book since as far as I'm aware they don't use (or at least don't exclusively use) the newer Adobe DRM.

It probably isn't, I just didn't get around to trying it with the old version of DE

I've always just stuck with ADE 2 so I know it won't be. So far it hasn't stopped working for any of the places I get ebooks.

@x0thrmc-exe
Copy link

Okay, I've solved it. You need to go into Calibre preferences, and go into the plugin's preferences and delete your Adobe Digital Editions key. It seems that if you add it yourself, you get this ascii error. If you try adding a DRM book but you don't have any keys added, the plugin will automatically do some automated search for the correct key (that will not give you an ascii error) and the DRM will be gone.

OMG this worked! I was skeptical based on how many times I deleted and reset everything, but I simply did your steps and the book opened in Calibre no problem. After months I finally have a no DRM copy of that book. Thanks!

I've always just stuck with ADE 2 so I know it won't be. So far it hasn't stopped working for any of the places I get ebooks.

I also recently tried the same book i was having problems with in ADE 2 after finding an installer on archive.org. It would not open in ADE 2, giving some error about the key.

@ElleKayEm
Copy link

I also recently tried the same book i was having problems with in ADE 2 after finding an installer on archive.org. It would not open in ADE 2, giving some error about the key.

Probably is the newer Adobe DRM when that happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hardened DRM