noDRM / DeDRM_tools

DeDRM tools for ebooks
7.04k stars 314 forks source link

DeDRM 10.0.9 "string argument should contain only ASCII characters" error #481

Closed spicyllamas closed 8 months ago

spicyllamas commented 8 months ago

Question / bug report

I'm using DeDRM 10.0.9 on Calibre 7.2 alongside the DeACSM plugin. When I try to import an ACSM from Adobe's sample library, DeDRM is producing the "string argument should contain only ASCII characters" error. I also tried deleting the saved Adobe key from DeDRM's customization and re-adding the book.

Which version of Calibre are you running?

7.2

Which version of the DeDRM plugin are you running?

v10.0.9

If applicable, which version of the Kindle software are you running?

No response

Log output

calibre 7.2  embedded-python: True
Linux-6.6.10-76060610-generic-x86_64-with-glibc2.35 Linux ('64bit', 'ELF')
('Linux', '6.6.10-76060610-generic', '#202401051437~1704728131~22.04~24d69e2 SMP PREEMPT_DYNAMIC Mon J')
Python 3.11.5
Interface language: None
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (10, 0, 9)
QPA platform: xcb
ApplicationPaletteChange event ignored
Using calibre Qt style: True
[0.00] Starting up...
[0.00] Showing splash screen...
[0.09] splash screen shown
[0.09] Initializing db...
[0.12] db initialized
[0.12] Constructing main UI...
[0.61] main UI initialized...
[0.61] Hiding splash screen
[0.71] GUI main window shown
[0.74] QuickView starting
[0.74] QuickView started
[0.93] splash screen hidden
[0.93] Started up in 0.93 seconds with 7 books
[3.67] Starting the smartdevice driver
DeACSM v0.0.16: Trying to parse file URLLink.acsm
DeACSM v0.0.16: Try to fulfill ...
Notifying server ...
Notifying server https://contentserver.adobe.com/fulfillment/FulfillmentNotification
Fulfillment notification successful.
DeACSM v0.0.16: Downloading book ...
DeACSM v0.0.16: Loading book from http://contentserver.adobe.com/media/98cdb717-fa80-407c-a076-b520eb149de8.pdf
Download took 974 ms (HTTP 200)
That's a PDF file
DeACSM v0.0.16: Downloaded PDF, adding encryption config ...
Searching for startxref ...
Got startxref: 1051475
Found ENC after 5 attempts - took 0 ms
Found EBX after 1443 attempts - took 3 ms

Encryption handler:
<</Root 1416 0 R/Info 1414 0 R/Encrypt 1432 0 R/ID[<3508AA28DA705AA2EEA8944CC694EC4B><18D59E5AC55544ED8A5D4F5FE59921B5>]/Size 1433>>
EBX handler:
<</Length 128/EBX_TITLE(Dracula)/Filter/EBX_HANDLER/EBX_AUTHOR(Bram Stoker)/V 4/ADEPT_ID(urn:uuid:98cdb717-fa80-407c-a076-b520eb149de8)>>
Trimmed encryption handler:
<</Root 1416 0 R/Info 1414 0 R/Encrypt 1432 0 R/ID[<3508AA28DA705AA2EEA8944CC694EC4B><18D59E5AC55544ED8A5D4F5FE59921B5>]/Size 1433>>
Updated EBX handler not logged due to sensitive data
Whole DRM patching took 6 milliseconds.
DeACSM v0.0.16: File successfully fulfilled ...
DeACSM v0.0.16: Executing plugin DeDRM ...
DeDRM v10.0.9: Trying to decrypt e8az3yfg.pdf
DeDRM v10.0.9: e8az3yfg.pdf is a PDF ebook with encryption EBX_HANDLER
DeDRM v10.0.9: e8az3yfg.pdf is a PDF ebook (EBX) for UUID b1e22a4f-d259-44f6-adb6-07955e39f00e
DeDRM v10.0.9: Trying UUID-matched encryption key DeACSM_uuid_b1e22a4f-d259-44f6-adb6-07955e39f00e
DeDRM v10.0.9: Exception when decrypting after 0.1 seconds - trying other keys
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_plugins.dedrm.__init__", line 679, in PDFIneptDecrypt
    userkey = codecs.decode(userkeyhex, 'hex')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: decoding with 'hex' codec failed (ValueError: string argument should contain only ASCII characters)
DeACSM v0.0.16: Running file type plugin 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_plugins.deacsm.__init__", line 486, in run
    plugin_ret = plugin.run(rpl)
                 ^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 1046, in run
    decrypted_ebook = self.PDFDecrypt(path_to_ebook)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 903, in PDFDecrypt
    return self.PDFIneptDecrypt(path_to_ebook)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "calibre_plugins.dedrm.__init__", line 698, in PDFIneptDecrypt
    userkey = codecs.decode(userkeyhex,'hex')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: decoding with 'hex' codec failed (ValueError: string argument should contain only ASCII characters)
DeACSM v0.0.16: Plugin returned nothing - skipping
Syntax Error: Couldn't find the 'EBX_HANDLER' security handler
pdfinfo errored out with return code: 1
Traceback (most recent call last):
  File "calibre/customize/ui.py", line 469, in get_file_type_metadata
  File "calibre/customize/builtins.py", line 324, in get_metadata
  File "calibre/ebooks/metadata/pdf.py", line 124, in get_metadata
ValueError: Could not read info dict from PDF
Added URLLink to db in: 0.1
Added 1 books in 2.9 seconds
ElleKayEm commented 8 months ago

I haven't used DeACSM myself. But I believe I've seen someone mention a workaround of saving the key from the ACSM Input plugin and manually importing it into the DeDRM plugin.

spicyllamas commented 8 months ago

I haven't used DeACSM myself. But I believe I've seen someone mention a workaround of saving the key from the ACSM Input plugin and manually importing it into the DeDRM plugin.

Oh, yeah deleting the auto-imported one and importing it myself worked. Thank you!

ElleKayEm commented 8 months ago

Thanks for confirming that worked.