Skip to content

"'Curve' object has no attribute 'p'" in recover_public_keys() #319

@opacey

Description

@opacey

When calling:

generatorPoint = ecdsa.ellipticcurve.PointJacobi(SECP256k1, secp256k1_generator_x, secp256k1_generator_y, 1, secp256k1_group_order, True)
sig = ecdsa.ecdsa.Signature(r, s)
pubkey1, pubkey2 = sig.recover_public_keys(message, generatorPoint)

I get the error:

Traceback (most recent call last):
  File "sig2pubkey.py", line 100, in <module>
    pubkey1, pubkey2 = sig.recover_public_keys(message, generatorPoint)
  File "~/.local/lib/python3.10/site-packages/ecdsa/ecdsa.py", line 113, in recover_public_keys
    pow(x, 3, curve.p()) + (curve.a() * x) + curve.b()
AttributeError: 'Curve' object has no attribute 'p'

Indeed the Curve object does not have a p attribute, but it does contain an ecdsa/ellipticcurve/CurveFp() object (named curve_secp256k1 in my case) which has a p attribute.

Could this be a bug? If not I'd be v grateful for any tips on how to fix my own code!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions