Skip to content

Commit

Permalink
Force plugin to use TLS v1.2 instead of v1.3.
Browse files Browse the repository at this point in the history
This is needed due to a change on Adobe's end, breaking
Python > 3.7.16.

Fixes #105.
  • Loading branch information
Leseratte10 committed Sep 17, 2024
1 parent 6c29c42 commit 2dcf26b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions calibre-plugin/libadobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,13 @@ def sendHTTPRequest_getSimple(URL):
# It appears as if lots of book distributors have either invalid or expired certs ...
# No idea how Adobe handles that (pinning?), but we can just ignore SSL errors and continue anyways.
# Not the best solution, but it works.
ctx = ssl.create_default_context()
try:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
# This is needed due to an Adobe change.
# Without this, only Python <= 3.7.16 can connect, 3.7.17 and above fail.
except:
ctx = ssl.create_default_context()

ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

Expand Down Expand Up @@ -328,7 +334,13 @@ def sendPOSTHTTPRequest(URL, document, type, returnRC = False):
# It appears as if lots of book distributors have either invalid or expired certs ...
# No idea how Adobe handles that (pinning?), but we can just ignore SSL errors and continue anyways.
# Not the best solution, but it works.
ctx = ssl.create_default_context()
try:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
# This is needed due to an Adobe change.
# Without this, only Python <= 3.7.16 can connect, 3.7.17 and above fail.
except:
ctx = ssl.create_default_context()

ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

Expand Down

0 comments on commit 2dcf26b

Please sign in to comment.