Merge branch 'master' into 46-docstrings

This commit is contained in:
Sergi Delgado Segura
2019-12-16 12:02:04 +01:00
2 changed files with 3 additions and 3 deletions

View File

@@ -246,7 +246,7 @@ class Cryptographer:
raise ValueError("Wrong return type. Return type must be 'str' or 'bytes'") raise ValueError("Wrong return type. Return type must be 'str' or 'bytes'")
if not isinstance(sk, ec.EllipticCurvePrivateKey): if not isinstance(sk, ec.EllipticCurvePrivateKey):
logger.error("Wrong public key.") logger.error("The value passed as sk is not a private key (EllipticCurvePrivateKey).")
return None return None
else: else:
@@ -274,7 +274,7 @@ class Cryptographer:
""" """
if not isinstance(pk, ec.EllipticCurvePublicKey): if not isinstance(pk, ec.EllipticCurvePublicKey):
logger.error("Wrong public key.") logger.error("The value passed as pk is not a public key (EllipticCurvePublicKey).")
return False return False
if isinstance(signature, str): if isinstance(signature, str):

View File

@@ -11,4 +11,4 @@ def check_sha256_hex_format(value):
Returns: Returns:
:mod:`bool`: Wether or not the value matches the format. :mod:`bool`: Wether or not the value matches the format.
""" """
return isinstance(value, str) and re.search(r"^[0-9A-Fa-f]{64}$", value) is not None return isinstance(value, str) and re.match(r"^[0-9A-Fa-f]{64}$", value) is not None