Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

TypeError instead of InvalidPointError on VerifyingKey.from_public_point(INFINITY)

Aperta
#341 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cryptography

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
975
Fork
342
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tlsfuzzer/python-ecdsa

Tutte le issue di tlsfuzzer/python-ecdsa

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.