Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

TypeError instead of InvalidPointError on VerifyingKey.from_public_point(INFINITY)

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

Nobody has claimed this yet.

Assessment

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

Research direction

Start at VerifyingKey.from_public_point in ecdsa/keys.py and follow the Public_key validation in ecdsa/ecdsa.py shown in the traceback. Reproduce the call with INFINITY and verify that point validation raises the intended malformed-point exception instead of TypeError; the related question also concerns how the infinity point is identified.

Written by the indexing model from the issue text.

Description

bug help wanted

I was experimenting to understand how the library handles failures. I don't expect the following line to work but I do expect it to raise a different error (MalformedPoint, not Type).

VerifyingKey.from_public_point(INFINITY)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[3], line 1
----> 1 VerifyingKey.from_public_point(INFINITY)

File ~/miniconda3/envs/de/lib/python3.9/site-packages/ecdsa/keys.py:170, in VerifyingKey.from_public_point(cls, point, curve, hashfunc, validate_point)
    168 self.default_hashfunc = hashfunc
    169 try:
--> 170     self.pubkey = ecdsa.Public_key(
    171         curve.generator, point, validate_point
    172     )
    173 except ecdsa.InvalidPointError:
    174     raise MalformedPointError("Point does not lay on the curve")

File ~/miniconda3/envs/de/lib/python3.9/site-packages/ecdsa/ecdsa.py:151, in Public_key.__init__(self, generator, point, verify)
    149 n = generator.order()
    150 p = self.curve.p()
--> 151 if not (0 <= point.x() < p) or not (0 <= point.y() < p):
    152     raise InvalidPointError(
    153         "The public point has x or y out of range."
    154     )
    155 if verify and not self.curve.contains_point(point.x(), point.y()):

TypeError: '<=' not supported between instances of 'int' and 'NoneType'

Related: for cases where one wishes to avoid the point at infinity is this the right way to detect it if point == ellipticcurve.INFINITY? I kind of expected infinity to vary by the curve family but there's nothing under eg SECKP256k1 that I can find.

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.