diff --git a/common/cryptographer.py b/common/cryptographer.py index 873df97..93fc72a 100644 --- a/common/cryptographer.py +++ b/common/cryptographer.py @@ -246,7 +246,7 @@ class Cryptographer: raise ValueError("Wrong return type. Return type must be 'str' or 'bytes'") 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 else: @@ -274,7 +274,7 @@ class Cryptographer: """ 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 if isinstance(signature, str): diff --git a/common/tools.py b/common/tools.py index 634e7a4..6d539b1 100644 --- a/common/tools.py +++ b/common/tools.py @@ -11,4 +11,4 @@ def check_sha256_hex_format(value): Returns: :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