cryptodome fallback

main
Bob Mottram 2020-03-04 09:59:08 +00:00
parent f6869f9308
commit 596d3a8747
4 changed files with 23 additions and 15 deletions

View File

@ -9,14 +9,16 @@ __status__ = "Production"
# see https://tools.ietf.org/html/draft-cavage-http-signatures-06
from Cryptodome.PublicKey import RSA
from Cryptodome.Hash import SHA256
from Cryptodome.Signature import pkcs1_15
try:
from Cryptodome.PublicKey import RSA
from Cryptodome.Hash import SHA256
from Cryptodome.Signature import pkcs1_15
except ImportError:
from Crypto.PublicKey import RSA
from Crypto.Hash import SHA256
#from Crypto.Signature import PKCS1_v1_5
from Crypto.Signature import pkcs1_15
#from Crypto.PublicKey import RSA
#from Crypto.Hash import SHA256
##from Crypto.Signature import PKCS1_v1_5
#from Crypto.Signature import pkcs1_15
from requests.auth import AuthBase
import base64
import json

View File

@ -14,8 +14,10 @@ import subprocess
import shutil
from random import randint
from pathlib import Path
from Cryptodome.PublicKey import RSA
#from Crypto.PublicKey import RSA
try:
from Cryptodome.PublicKey import RSA
except ImportError:
from Crypto.PublicKey import RSA
from shutil import copyfile
from webfinger import createWebfingerEndpoint
from webfinger import storeWebfingerEndpoint

View File

@ -14,8 +14,10 @@ import json
from time import gmtime, strftime
from pprint import pprint
from person import createPerson
from Cryptodome.Hash import SHA256
#from Crypto.Hash import SHA256
try:
from Cryptodome.Hash import SHA256
except ImportError:
from Crypto.Hash import SHA256
from httpsig import signPostHeaders
from httpsig import verifyPostHeaders
from httpsig import messageContentDigest

View File

@ -7,10 +7,12 @@ __email__ = "bob@freedombone.net"
__status__ = "Production"
import base64
from Cryptodome.PublicKey import RSA
from Cryptodome.Util import number
#from Crypto.PublicKey import RSA
#from Crypto.Util import number
try:
from Cryptodome.PublicKey import RSA
from Cryptodome.Util import number
except ImportError:
from Crypto.PublicKey import RSA
from Crypto.Util import number
import requests
import json
import os