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

Use pycryptodome instead of pycrypto #4

Merged
merged 1 commit into from
Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions calibre-plugin/libadobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@
Helper library with code needed for Adobe stuff.
'''

from Crypto import Random
from uuid import getnode
import os, hashlib, base64
import urllib.request, ssl
from Crypto.Cipher import AES
from datetime import datetime, timedelta

from lxml import etree
import rsa


from Crypto.PublicKey import RSA
from Crypto.Hash import SHA
try:
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA
except ImportError:
# Debian (and Ubuntu) ship pycryptodome, but not in its compatible mode with pycrypto
# If `Crypto` can't be found, try under pycryptodome's own namespace
from Cryptodome import Random
from Cryptodome.Cipher import AES
from Cryptodome.PublicKey import RSA
from Cryptodome.Hash import SHA

from oscrypto import keys
from oscrypto.asymmetric import dump_certificate, dump_private_key, dump_public_key
Expand Down
13 changes: 10 additions & 3 deletions calibre-plugin/libadobeAccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
import base64
import os, locale, platform

from Crypto.PublicKey import RSA
from Crypto.Util.asn1 import DerSequence
from Crypto.Cipher import PKCS1_v1_5
try:
from Crypto.PublicKey import RSA
from Crypto.Util.asn1 import DerSequence
from Crypto.Cipher import PKCS1_v1_5
except ImportError:
# Debian (and Ubuntu) ship pycryptodome, but not in its compatible mode with pycrypto
# If `Crypto` can't be found, try under pycryptodome's own namespace
from Cryptodome.PublicKey import RSA
from Cryptodome.Util.asn1 import DerSequence
from Cryptodome.Cipher import PKCS1_v1_5

try:
from libadobe import addNonce, sign_node, sendRequestDocu, sendHTTPRequest
Expand Down