ECPy
ECPy copied to clipboard
Signing with EDDSA (curve25519) throws AttributeError: _coord_size
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 ...
This project does EdDSA with Ed25519 and blake2b correctly: https://github.com/Matoking/python-ed25519-blake2b
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.