model/utils.py
def compare_signature(public_key: str, signature: str, content: dict) -> bool:
    """Verifies if the signature is valid"""

    public_key = import_key(public_key)
    verifier = PKCS1_v1_5.new(public_key)
    encoded_content = json.dumps(content, sort_keys=True).encode()
    h = SHA256.new(encoded_content)

    return verifier.verify(h, binascii.unhexlify(signature))
Verifies if the signature is valid
Verifies if the signature is valid
Verifies if the signature is valid
def compare_signature(public_key: str, signature: str, content: dict) -> bool:
    public_key = import_key(public_key)
    verifier = PKCS1_v1_5.new(public_key)
    encoded_content = json.dumps(content, sort_keys=True).encode()
    h = SHA256.new(encoded_content)
    return verifier.verify(h, binascii.unhexlify(signature))
def compare_signature ( public_key : str , signature : str , content : dict ) -> bool : public_key = import_key ( public_key ) verifier = PKCS1_v1_5 . new ( public_key ) encoded_content = json . dumps ( content , sort_keys = True ) . encode ( ) h = SHA256 . new ( encoded_content ) return verifier . verify ( h , binascii . unhexlify ( signature ) )
Verifies if the signature is valid
Verifies if the signature is valid
"""Verifies if the signature is valid"""
public_key
str
signature
str
content
dict