python-ecdsa icon indicating copy to clipboard operation
python-ecdsa copied to clipboard

ecdsa.keys.VerifyingKey.verify_digest should fail for CurveEdTw

Open dfordivam opened this issue 1 year ago • 1 comments

The verify_digest should explicitly fail if used with CurveEdTw, otherwise it leads to very hard to understand error:

AttributeError: 'PublicKey' object has no attribute 'order'

By the way, I was trying to verify the signature which was created for a message hashed with blake2b, and the correct usage is this (ie not to use verify_digest). But I had to study the code to understand the mistake.

    pk: VerifyingKey = VerifyingKey.from_string(
        public_key,
        curve=Ed25519,
    )
    hash_object = blake2b(digest_size=32)
    hash_object.update(message)
    return pk.verify(
        signature=signature,
        data=hash_object.digest()
    )

dfordivam avatar Nov 13 '24 08:11 dfordivam

Both good points, but I don't think I'll have the time to fix them any time soon. Help welcome.

tomato42 avatar Nov 13 '24 11:11 tomato42