added typos to cryptography

This commit is contained in:
Adolfo Gómez García 2021-07-08 22:31:25 +02:00
parent 2520cce429
commit f2643df05f

View File

@ -57,6 +57,7 @@ if typing.TYPE_CHECKING:
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey
from cryptography.hazmat.primitives.asymmetric.dh import DHPrivateKey from cryptography.hazmat.primitives.asymmetric.dh import DHPrivateKey
class CryptoManager: class CryptoManager:
instance = None instance = None
@ -199,7 +200,11 @@ class CryptoManager:
except Exception: # Error decoding crypted element, return empty one except Exception: # Error decoding crypted element, return empty one
return '' return ''
def loadPrivateKey(self, rsaKey: str) -> typing.Union['RSAPrivateKey', 'DSAPrivateKey', 'DHPrivateKey', 'EllipticCurvePrivateKey']: def loadPrivateKey(
self, rsaKey: str
) -> typing.Union[
'RSAPrivateKey', 'DSAPrivateKey', 'DHPrivateKey', 'EllipticCurvePrivateKey'
]:
try: try:
return serialization.load_pem_private_key( return serialization.load_pem_private_key(
settings.RSA_KEY.encode(), password=None, backend=default_backend() settings.RSA_KEY.encode(), password=None, backend=default_backend()
@ -207,7 +212,9 @@ class CryptoManager:
except Exception as e: except Exception as e:
raise e raise e
def loadCertificate(self, certificate: typing.Union[str, bytes]) -> x509.Certificate: def loadCertificate(
self, certificate: typing.Union[str, bytes]
) -> x509.Certificate:
if isinstance(certificate, str): if isinstance(certificate, str):
certificate = certificate.encode() certificate = certificate.encode()