mirror of
https://github.com/Leseratte10/acsm-calibre-plugin.git
synced 2024-12-22 17:29:56 +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.
|
Helper library with code needed for Adobe stuff.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from Crypto import Random
|
|
||||||
from uuid import getnode
|
from uuid import getnode
|
||||||
import os, hashlib, base64
|
import os, hashlib, base64
|
||||||
import urllib.request, ssl
|
import urllib.request, ssl
|
||||||
from Crypto.Cipher import AES
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
import rsa
|
import rsa
|
||||||
|
|
||||||
|
try:
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto import Random
|
||||||
from Crypto.Hash import SHA
|
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 import keys
|
||||||
from oscrypto.asymmetric import dump_certificate, dump_private_key, dump_public_key
|
from oscrypto.asymmetric import dump_certificate, dump_private_key, dump_public_key
|
||||||
|
@ -2,9 +2,16 @@ from lxml import etree
|
|||||||
import base64
|
import base64
|
||||||
import os, locale, platform
|
import os, locale, platform
|
||||||
|
|
||||||
from Crypto.PublicKey import RSA
|
try:
|
||||||
from Crypto.Util.asn1 import DerSequence
|
from Crypto.PublicKey import RSA
|
||||||
from Crypto.Cipher import PKCS1_v1_5
|
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:
|
try:
|
||||||
from libadobe import addNonce, sign_node, sendRequestDocu, sendHTTPRequest
|
from libadobe import addNonce, sign_node, sendRequestDocu, sendHTTPRequest
|
||||||
|
Loading…
Reference in New Issue
Block a user