Leseratte10 / acsm-calibre-plugin

Calibre plugin for ACSM->EPUB and ACSM->PDF conversion.
https://www.mobileread.com/forums/showthread.php?t=341975
GNU General Public License v3.0
593 stars 23 forks source link

ACSM Not Converted #58

Closed jackaltrade closed 11 months ago

jackaltrade commented 11 months ago

Bug description

Hi,

I think this may be related to some existing SSL issues but I'm not sure so I'm dropping it here. Feel free to merge accordingly.

I had DeACSM and DeDRM working correctly in Calibre but after updating to 6.23 DeACSM stopped importing as an EPUB. The files show up in Calibre as tiny ACSM files. I enabled debugging and got this:


calibre 6.23  embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.10.1
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (10, 0, 3) && KoboTouchExtended (3, 6, 3)
calibre 6.23  embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.10.1
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (10, 0, 3) && KoboTouchExtended (3, 6, 3)
QPA platform: windows
devicePixelRatio: 1.5
logicalDpi: 96.0 x 96.0
physicalDpi: 110.96245733788396 x 110.83636363636363
[0.00] Starting up...
[0.00] Showing splash screen...
[0.22] splash screen shown
[0.22] Initializing db...
[0.31] db initialized
[0.31] Constructing main UI...
[1.42] main UI initialized...
[1.42] Hiding splash screen
Starting QuickView
[23.48] splash screen hidden
[23.48] Started up in 23.48 seconds with 13 books
stdout+stderr from file dialog helper: [b'', b'']
piped data from file dialog helper: [b'L\xd7\x07\xd0_\xc3\xcf\x17\xa3}\\\xc8"\x7f\xdbJ\xcds\x14\x8d\xc7\xf5q\xd4\xda\xa0m\x1c!\xfe\xb8\xc8', b'C:\\Users\\REMOVED.acsm']
Running file type plugin DeACSM failed with traceback:
Traceback (most recent call last):
  File "urllib\request.py", line 1348, in do_open
  File "http\client.py", line 1282, in request
  File "http\client.py", line 1328, in _send_request
  File "http\client.py", line 1277, in endheaders
  File "http\client.py", line 1037, in _send_output
  File "http\client.py", line 975, in send
  File "http\client.py", line 1454, in connect
  File "ssl.py", line 512, in wrap_socket
  File "ssl.py", line 1070, in _create
  File "ssl.py", line 1341, in do_handshake
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "calibre\customize\ui.py", line 187, in _run_filetype_plugins
  File "calibre_plugins.deacsm.__init__", line 422, in run
  File "calibre_plugins.deacsm.__init__", line 324, in download
  File "C:\Users\REMOVED\AppData\Roaming\calibre\plugins\DeACSM.zip\libadobe.py", line 267, in sendHTTPRequest_DL2FILE
  File "urllib\request.py", line 216, in urlopen
  File "urllib\request.py", line 519, in open
  File "urllib\request.py", line 536, in _open
  File "urllib\request.py", line 496, in _call_chain
  File "urllib\request.py", line 1391, in https_open
  File "urllib\request.py", line 1351, in do_open
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)>
DeACSM v0.0.16: Trying to parse file REMOVED.acsm
DeACSM v0.0.16: Try to fulfill ...
Notifying server ...
Notifying server https://acsepub.contentreserve.com/fulfillment/FulfillmentNotification
Fulfillment notification successful.
Notifying optional server https://ofs.contentreserve.com/ACSNotificationService.svc/Notify
Weird Fulfillment Notification response: 
DeACSM v0.0.16: Downloading book ...
DeACSM v0.0.16: Loading book from https://acs.cdn.overdrive.com/ACSStore1/0111-1/5CC/7F7/F4/{REMOVED}Fmt410.epub

The file ends there. But copy/pasting that link in a browser downloaded an EPUB file which I was able to successfully import/remove DRM from, so something is going wrong with DeACSM.

Operating system

Windows

Which version of Calibre are you running?

6.23

Which version of the ACSM Input plugin are you running?

v0.0.16

Import type

Clicking the 'Add books' button in the menu bar

Further information

No response

Leseratte10 commented 11 months ago

This is most likely an issue with your Windows certificate store. Most browsers handle SSL on their own and don't have to rely on that (so they don't run into issues), but Python uses it by default.

Overdrive seems to have changed something recently as you are not the first person to run into this issue.

For more information about this issue, see here or here or here.

Can you try downloading the new LetsEncrypt intermediate CA from https://letsencrypt.org/certs/lets-encrypt-r3.der , import it into the certificate store (just double-clicking on the file and following the prompts should be enough on Windows) and see if that fixes the issue?

If that doesn't help, can you downgrade Calibre again and see if it works again or is still broken?

jackaltrade commented 11 months ago

That appears to have done it - thanks for the prompt help. Hopefully this isn't an ongoing thing but I'll try this first for similar issues in the future.

Leseratte10 commented 11 months ago

Thanks for confirming. It's unlikely that this is going to happen again soon. At least not until September 2025 when that R3 certificate expires, but I'd hope that Microsoft will have fixed their update processes by then.