Closed Phil242 closed 5 years ago
Here's what I get when i try to replicate (on macOS) -
$ pip3 install -e .
Obtaining file:///<path to cloned repo>/fastecdsa
Installing collected packages: fastecdsa
Running setup.py develop for fastecdsa
Successfully installed fastecdsa
$ cat fastecdsa.py
from fastecdsa import keys, curve
# generate a keypair (i.e. both keys) for curve P256
priv_key, pub_key = keys.gen_keypair(curve.P256)
# generate a private key for curve P256
priv_key = keys.gen_private_key(curve.P256)
# get the public key corresponding to the private key we just generated
pub_key = keys.get_public_key(priv_key, curve.P256)
$ python3 fastecdsa.py
Traceback (most recent call last):
File "fastecdsa.py", line 1, in <module>
from fastecdsa import keys, curve
File "/<path to file>/fastecdsa.py", line 1, in <module>
from fastecdsa import keys, curve
ImportError: cannot import name 'keys' from 'fastecdsa' (/<path to file>/fastecdsa.py)
$ mv fastecdsa.py keygen.py
<no stdout>
$ python3 keygen.py
<no stdout>
The issue is that your filename is the same as the package name, so it's trying to import the keys module from your file rather than the package. Renaming the file to anything other than fastecdsa.py
should do the trick.
Cheers, Anton
Hello,
Just git clone the project, and no error while install it under Python3 but I can't run the first example, because of an import problem:
$ python3 fastecdsa.py Traceback (most recent call last): File "fastecdsa.py", line 1, in
from fastecdsa import keys, curve
File "/mnt/hgfs/Kali/Inso2019/fastecdsa.py", line 1, in
from fastecdsa import keys, curve
ImportError: cannot import name 'keys' from 'fastecdsa' (/mnt/hgfs/Kali/Inso2019/fastecdsa.py)
$ cat fastecdsa.py from fastecdsa import keys, curve
generate a keypair (i.e. both keys) for curve P256
priv_key, pub_key = keys.gen_keypair(curve.P256)
generate a private key for curve P256
priv_key = keys.gen_private_key(curve.P256)
get the public key corresponding to the private key we just generated
pub_key = keys.get_public_key(priv_key, curve.P256)
From the past equivalent problem the advice was to move to more recent version than 1.1.2 I have clone the 1.7.1. Seems the issue doesn't gone.
What log or else would help you to understand what happened on my machine? (A up-to-date Linux Kali, Linux distribution derived from Debian)
Regards,
Phil