Skip to content

Signing with EDDSA (curve25519) throws AttributeError: _coord_size #28

@aptly-io

Description

@aptly-io

Trying to sign with EDDSA as below returns me an Exception.
Is there someone who can explain what I do wrong?

(I'm using 1.2.5 on python3 3.7.5)

from ecpy.curves import Curve,Point
from ecpy.keys import ECPublicKey, ECPrivateKey
from ecpy.eddsa import EDDSA
from ecpy.ecrand import rnd
from hashlib import blake2b

curve = Curve.get_curve('Curve25519') # Montgomery with size 256

priv_key = rnd(curve.order)

pv_key = ECPrivateKey(priv_key, curve)

hasher = blake2b()
signer = EDDSA(hasher)

sig = signer.sign(b'Lorem ipsu', pv_key)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/francis/dev/projects/edge/venv37-imx/lib/python3.7/site-packages/ecpy/eddsa.py", line 118, in sign
    return self._do_sign(msg, pv_key)
  File "/home/francis/dev/projects/edge/venv37-imx/lib/python3.7/site-packages/ecpy/eddsa.py", line 125, in _do_sign
    size = curve._coord_size()
  File "/home/francis/dev/projects/edge/venv37-imx/lib/python3.7/site-packages/ecpy/curves.py", line 120, in __getattr__
    raise AttributeError(name)
AttributeError: _coord_size

I assume one has to use the Ed25519 instead of Curve25519 ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions