cryptography is in requirements.txt; we dont need to check for it

This commit is contained in:
jesopo 2020-02-20 15:12:00 +00:00
parent b260c80c31
commit 8a6270fc97
2 changed files with 6 additions and 14 deletions

View file

@ -27,9 +27,6 @@ class Module(ModuleManager.BaseModule):
raise ValueError("`tls-key` not provided in bot config") raise ValueError("`tls-key` not provided in bot config")
if not "tls-certificate" in self.bot.config: if not "tls-certificate" in self.bot.config:
raise ValueError("`tls-certificate` not provided in bot config") raise ValueError("`tls-certificate` not provided in bot config")
if not ap_security.has_crypto:
raise ValueError("cyprography library is not installed "
"(https://pypi.org/project/cryptography/)")
server_username, instance = ap_utils.split_username(server_username) server_username, instance = ap_utils.split_username(server_username)
self.server = ap_server.Server(self.bot, self.exports, self.server = ap_server.Server(self.bot, self.exports,

View file

@ -1,17 +1,12 @@
import base64, typing import base64, typing
try: from cryptography import x509
from cryptography import x509 from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import padding, rsa
from cryptography.hazmat.primitives.asymmetric import padding, rsa from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import Encoding from cryptography.hazmat.primitives.serialization import Encoding
from cryptography.hazmat.primitives.serialization import PublicFormat from cryptography.hazmat.primitives.serialization import PublicFormat
has_crypto = True
except ModuleNotFoundError:
has_crypto = False
SIGNATURE_FORMAT = ( SIGNATURE_FORMAT = (
"keyId=\"%s\",headers=\"%s\",signature=\"%s\",algorithm=\"rsa-sha256\"") "keyId=\"%s\",headers=\"%s\",signature=\"%s\",algorithm=\"rsa-sha256\"")