mirror of
https://github.com/Leseratte10/acsm-calibre-plugin.git
synced 2024-12-22 09:19:55 +06:00
If Crypto can't be found, try to import Cryptodome
This commit is contained in:
parent
89dcaf75c1
commit
aca0157004
@ -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
|
||||
|
@ -2,9 +2,16 @@ from lxml import etree
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user