Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aptly-io opened this issue Aug 16, 2021 · 2 comments
Open

Comments

@aptly-io
Copy link

aptly-io commented Aug 16, 2021

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 ...

@aptly-io
Copy link
Author

This project does EdDSA with Ed25519 and blake2b correctly: https://github.com/Matoking/python-ed25519-blake2b

@cslashm
Copy link
Owner

cslashm commented Aug 23, 2021

You cannot use 'Curve25519' with eddsa, you have to use 'Ed25519'
Curve25519 is for DH, Ed25519 is for signing.
I should add a check in the builder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants