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

ECC key format is not supported #16

Open
dage0127 opened this issue May 31, 2023 · 1 comment
Open

ECC key format is not supported #16

dage0127 opened this issue May 31, 2023 · 1 comment

Comments

@dage0127
Copy link

运行报错,“ValueError: ECC key format is not supported”。
安装了pycryptodome的3.10.1,3.10.4,3.17版本,都报相同的错误。

(base) deepl@ht-PowerEdge-R740:~/explore/python-psi$ PSI_CONFIG=./config/server.config.yaml psi_run server 127.0.0.1:1234
2023-05-31 13:15:13.443 - INFO: start prepare
Traceback (most recent call last):
File "/home/haitaiwork/deepl/anaconda3/bin/psi_run", line 8, in
sys.exit(main())
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/psi/main.py", line 52, in main
start_server(args.address)
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/psi/server.py", line 21, in start_server
server.prepare() # prepare stage
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/psi/psi/server.py", line 22, in prepare
self.oprf_server.prepare()
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/psi/oprf/server.py", line 43, in prepare
receiver.prepare()
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/psi/extension/receiver.py", line 39, in prepare
base.send(self._pair, t_col_bytes, u_col_bytes)
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/psi/base/sender.py", line 17, in send
bk = bytes_to_key(bk_bytes)
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/psi/serialize/ecc.py", line 19, in bytes_to_key
return ECC.import_key(data)
File "/home/haitaiwork/deepl/anaconda3/lib/python3.9/site-packages/Crypto/PublicKey/ECC.py", line 1780, in import_key
raise ValueError("ECC key format is not supported")
ValueError: ECC key format is not supported

@mh739025250
Copy link
Member

这个应该不是pycryptodome的问题,问题应该出在socket的数据传输上。
我本地没法复现这个问题,如果你可以复现的话,可以在psi/base/sender.py的第17行插入一行代码
print(f"key {bk_bytes.hex()}")
观察程序的输出。
正常的key应该是以30开头的,长度为59的bytes(hex长度为118)。
如果不是,说明是socket数据传输的问题。

修改了代码之后,你需要pip install -e .来重新安装一下才能让修改的代码生效。

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