ecdsa.keys.VerifyingKey.verify_digest should fail for CurveEdTw

Open
#349 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cryptography

Research direction

Start at ecdsa.keys.VerifyingKey.verify_digest and compare its handling of CurveEdTw with the verify usage shown in the issue. Make the unsupported call fail explicitly with an understandable error, and verify that CurveEdTw users are directed toward verify rather than verify_digest.

Written by the indexing model from the issue text.

Description

bug help wanted

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()
    )
Dominant language
Python
Stars
973
Forks
343
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tlsfuzzer/python-ecdsa

All issues in tlsfuzzer/python-ecdsa

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.