Closed jinnang233 closed 5 months ago
Sorry, I didn't realize the problem with the python version
@jinnang233 Hey, thanks for trying out QuantCrypt! The library must be compatible with Python versions 3.10, 3.11 and 3.12. Were you using QuantCrypt with one of those Python versions? It's a weird error to receive, because I can see that the binaries exist in the directory.
I'm using python 3.12, which seems to be the supported version shown on pypi. However, when I use conda python3.12, it doesn't work properly. Only available with conda 3.10. The precompiled PQClean binaries in the site-packages directory are 3.10. I really like this project and thank you for your efforts in making post-quantum cryptography available to everyone.
The following is the output when using Python3.10
(base) C:\Users\jinna\qckey\test>conda activate qc-test-py10
(qc-test-py10) C:\Users\jinna\qckey\test>pip install quantcrypt
Collecting quantcrypt
Using cached quantcrypt-0.3.3-py3-none-any.whl.metadata (7.0 kB)
Collecting argon2-cffi<24.0.0,>=23.1.0 (from quantcrypt)
Using cached argon2_cffi-23.1.0-py3-none-any.whl.metadata (5.2 kB)
Collecting dotmap<2.0.0,>=1.3.30 (from quantcrypt)
Using cached dotmap-1.3.30-py3-none-any.whl (11 kB)
Collecting orjson<4.0.0,>=3.9.12 (from quantcrypt)
Downloading orjson-3.9.13-cp310-none-win_amd64.whl.metadata (50 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 50.6/50.6 kB 366.9 kB/s eta 0:00:00
Collecting pycryptodomex<4.0.0,>=3.20.0 (from quantcrypt)
Using cached pycryptodomex-3.20.0-cp35-abi3-win_amd64.whl.metadata (3.4 kB)
Collecting pydantic<3.0.0,>=2.5.3 (from quantcrypt)
Using cached pydantic-2.6.0-py3-none-any.whl.metadata (81 kB)
Collecting rich<14.0.0,>=13.7.0 (from quantcrypt)
Using cached rich-13.7.0-py3-none-any.whl.metadata (18 kB)
Collecting typer<0.10.0,>=0.9.0 (from typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached typer-0.9.0-py3-none-any.whl (45 kB)
Collecting types-zxcvbn<5.0.0.0,>=4.4.1.20240106 (from quantcrypt)
Using cached types_zxcvbn-4.4.1.20240106-py3-none-any.whl.metadata (1.6 kB)
Collecting zxcvbn<5.0.0,>=4.4.28 (from quantcrypt)
Using cached zxcvbn-4.4.28.tar.gz (407 kB)
Preparing metadata (setup.py) ... done
Collecting argon2-cffi-bindings (from argon2-cffi<24.0.0,>=23.1.0->quantcrypt)
Using cached argon2_cffi_bindings-21.2.0-cp36-abi3-win_amd64.whl (30 kB)
Collecting annotated-types>=0.4.0 (from pydantic<3.0.0,>=2.5.3->quantcrypt)
Using cached annotated_types-0.6.0-py3-none-any.whl.metadata (12 kB)
Collecting pydantic-core==2.16.1 (from pydantic<3.0.0,>=2.5.3->quantcrypt)
Downloading pydantic_core-2.16.1-cp310-none-win_amd64.whl.metadata (6.6 kB)
Collecting typing-extensions>=4.6.1 (from pydantic<3.0.0,>=2.5.3->quantcrypt)
Using cached typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)
Collecting markdown-it-py>=2.2.0 (from rich<14.0.0,>=13.7.0->quantcrypt)
Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich<14.0.0,>=13.7.0->quantcrypt)
Using cached pygments-2.17.2-py3-none-any.whl.metadata (2.6 kB)
Collecting click<9.0.0,>=7.1.1 (from typer<0.10.0,>=0.9.0->typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting colorama<0.5.0,>=0.4.3 (from typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting shellingham<2.0.0,>=1.3.0 (from typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.7.0->quantcrypt)
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting cffi>=1.0.1 (from argon2-cffi-bindings->argon2-cffi<24.0.0,>=23.1.0->quantcrypt)
Downloading cffi-1.16.0-cp310-cp310-win_amd64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi<24.0.0,>=23.1.0->quantcrypt)
Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Using cached quantcrypt-0.3.3-py3-none-any.whl (1.6 MB)
Using cached argon2_cffi-23.1.0-py3-none-any.whl (15 kB)
Downloading orjson-3.9.13-cp310-none-win_amd64.whl (134 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 134.2/134.2 kB 1.6 MB/s eta 0:00:00
Using cached pycryptodomex-3.20.0-cp35-abi3-win_amd64.whl (1.8 MB)
Using cached pydantic-2.6.0-py3-none-any.whl (394 kB)
Downloading pydantic_core-2.16.1-cp310-none-win_amd64.whl (1.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 8.8 MB/s eta 0:00:00
Using cached rich-13.7.0-py3-none-any.whl (240 kB)
Using cached types_zxcvbn-4.4.1.20240106-py3-none-any.whl (5.8 kB)
Using cached annotated_types-0.6.0-py3-none-any.whl (12 kB)
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Using cached pygments-2.17.2-py3-none-any.whl (1.2 MB)
Using cached shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Downloading cffi-1.16.0-cp310-cp310-win_amd64.whl (181 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.6/181.6 kB ? eta 0:00:00
Building wheels for collected packages: zxcvbn
Building wheel for zxcvbn (setup.py) ... done
Created wheel for zxcvbn: filename=zxcvbn-4.4.28-py2.py3-none-any.whl size=408152 sha256=f29190707ef00e6d541b5556a8d9147fcec1226cc3af23635b33f131d9ca3c27
Stored in directory: c:\users\jinna\appdata\local\pip\cache\wheels\ef\89\c6\a0e065af99073821bb4b83f6ec0561e981fc00498fe8e9c45d
Successfully built zxcvbn
Installing collected packages: zxcvbn, dotmap, typing-extensions, types-zxcvbn, shellingham, pygments, pycryptodomex, pycparser, orjson, mdurl, colorama, annotated-types, pydantic-core, markdown-it-py, click, cffi, typer, rich, pydantic, argon2-cffi-bindings, argon2-cffi, quantcrypt
Successfully installed annotated-types-0.6.0 argon2-cffi-23.1.0 argon2-cffi-bindings-21.2.0 cffi-1.16.0 click-8.1.7 colorama-0.4.6 dotmap-1.3.30 markdown-it-py-3.0.0 mdurl-0.1.2 orjson-3.9.13 pycparser-2.21 pycryptodomex-3.20.0 pydantic-2.6.0 pydantic-core-2.16.1 pygments-2.17.2 quantcrypt-0.3.3 rich-13.7.0 shellingham-1.5.4 typer-0.9.0 types-zxcvbn-4.4.1.20240106 typing-extensions-4.9.0 zxcvbn-4.4.28
(qc-test-py10) C:\Users\jinna\qckey\test>qclib keygen kyber
Successfully generated 'kyber-pubkey.qc' and 'kyber-seckey.qc' keyfiles!
@jinnang233 I didn't realize prebuilt CFFI binaries are only compatible with that Python version which they were compiled with. The easiest solution would be to pin Python version in PYPI to 3.10 and then later bump it together with the CI pipeline Python version. Alternative would be to matrix compile on all python versions and store the binaries for all python versions into the library, but this would bloat the package 3x times its size. I think I'll do the easy fix right now and later figure out if matrix compiling on separate versions is worth it.
Got it, thank you very much for your patient explanation.
@jinnang233 Please try the latest version of QuantCrypt (0.3.4) to see if it works correctly for you. I hard-pinned it to Python 3.12, with the binaries also built with Python 3.12.
It works perfectly. Thank you very much.
(base) C:\Users\jinna\qckey\test>conda create -n qctest-312 python=3.12
Collecting package metadata (current_repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 23.3.1
latest version: 23.11.0
Please update conda by running
$ conda update -n base -c conda-forge conda
Or to minimize the number of packages updated during conda update use
conda install conda=23.11.0
## Package Plan ##
environment location: C:\Users\jinna\miniforge3\envs\qctest-312
added / updated specs:
- python=3.12
done
#
# To activate this environment, use
#
# $ conda activate qctest-312
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) C:\Users\jinna\qckey\test>conda activate qctest-312
(qctest-312) C:\Users\jinna\qckey\test>pip install quantcrypt
Collecting quantcrypt
Downloading quantcrypt-0.3.4-py3-none-any.whl.metadata (7.8 kB)
Collecting argon2-cffi<24.0.0,>=23.1.0 (from quantcrypt)
Using cached argon2_cffi-23.1.0-py3-none-any.whl.metadata (5.2 kB)
Collecting dotmap<2.0.0,>=1.3.30 (from quantcrypt)
Using cached dotmap-1.3.30-py3-none-any.whl (11 kB)
Collecting orjson<4.0.0,>=3.9.12 (from quantcrypt)
Using cached orjson-3.9.13-cp312-none-win_amd64.whl.metadata (50 kB)
Collecting pycryptodomex<4.0.0,>=3.20.0 (from quantcrypt)
Using cached pycryptodomex-3.20.0-cp35-abi3-win_amd64.whl.metadata (3.4 kB)
Collecting pydantic<3.0.0,>=2.5.3 (from quantcrypt)
Using cached pydantic-2.6.0-py3-none-any.whl.metadata (81 kB)
Collecting rich<14.0.0,>=13.7.0 (from quantcrypt)
Using cached rich-13.7.0-py3-none-any.whl.metadata (18 kB)
Collecting typer<0.10.0,>=0.9.0 (from typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached typer-0.9.0-py3-none-any.whl (45 kB)
Collecting types-zxcvbn<5.0.0.0,>=4.4.1.20240106 (from quantcrypt)
Using cached types_zxcvbn-4.4.1.20240106-py3-none-any.whl.metadata (1.6 kB)
Collecting zxcvbn<5.0.0,>=4.4.28 (from quantcrypt)
Using cached zxcvbn-4.4.28-py2.py3-none-any.whl
Collecting argon2-cffi-bindings (from argon2-cffi<24.0.0,>=23.1.0->quantcrypt)
Using cached argon2_cffi_bindings-21.2.0-cp36-abi3-win_amd64.whl (30 kB)
Collecting annotated-types>=0.4.0 (from pydantic<3.0.0,>=2.5.3->quantcrypt)
Using cached annotated_types-0.6.0-py3-none-any.whl.metadata (12 kB)
Collecting pydantic-core==2.16.1 (from pydantic<3.0.0,>=2.5.3->quantcrypt)
Using cached pydantic_core-2.16.1-cp312-none-win_amd64.whl.metadata (6.6 kB)
Collecting typing-extensions>=4.6.1 (from pydantic<3.0.0,>=2.5.3->quantcrypt)
Using cached typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)
Collecting markdown-it-py>=2.2.0 (from rich<14.0.0,>=13.7.0->quantcrypt)
Using cached markdown_it_py-3.0.0-py3-none-any.whl.metadata (6.9 kB)
Collecting pygments<3.0.0,>=2.13.0 (from rich<14.0.0,>=13.7.0->quantcrypt)
Using cached pygments-2.17.2-py3-none-any.whl.metadata (2.6 kB)
Collecting click<9.0.0,>=7.1.1 (from typer<0.10.0,>=0.9.0->typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting colorama<0.5.0,>=0.4.3 (from typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting shellingham<2.0.0,>=1.3.0 (from typer[all]<0.10.0,>=0.9.0->quantcrypt)
Using cached shellingham-1.5.4-py2.py3-none-any.whl.metadata (3.5 kB)
Collecting mdurl~=0.1 (from markdown-it-py>=2.2.0->rich<14.0.0,>=13.7.0->quantcrypt)
Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting cffi>=1.0.1 (from argon2-cffi-bindings->argon2-cffi<24.0.0,>=23.1.0->quantcrypt)
Using cached cffi-1.16.0-cp312-cp312-win_amd64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi<24.0.0,>=23.1.0->quantcrypt)
Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Downloading quantcrypt-0.3.4-py3-none-any.whl (2.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.0/2.0 MB 3.8 MB/s eta 0:00:00
Using cached argon2_cffi-23.1.0-py3-none-any.whl (15 kB)
Using cached orjson-3.9.13-cp312-none-win_amd64.whl (134 kB)
Using cached pycryptodomex-3.20.0-cp35-abi3-win_amd64.whl (1.8 MB)
Using cached pydantic-2.6.0-py3-none-any.whl (394 kB)
Using cached pydantic_core-2.16.1-cp312-none-win_amd64.whl (1.9 MB)
Using cached rich-13.7.0-py3-none-any.whl (240 kB)
Using cached types_zxcvbn-4.4.1.20240106-py3-none-any.whl (5.8 kB)
Using cached annotated_types-0.6.0-py3-none-any.whl (12 kB)
Using cached click-8.1.7-py3-none-any.whl (97 kB)
Using cached markdown_it_py-3.0.0-py3-none-any.whl (87 kB)
Using cached pygments-2.17.2-py3-none-any.whl (1.2 MB)
Using cached shellingham-1.5.4-py2.py3-none-any.whl (9.8 kB)
Using cached typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Using cached cffi-1.16.0-cp312-cp312-win_amd64.whl (181 kB)
Installing collected packages: zxcvbn, dotmap, typing-extensions, types-zxcvbn, shellingham, pygments, pycryptodomex, pycparser, orjson, mdurl, colorama, annotated-types, pydantic-core, markdown-it-py, click, cffi, typer, rich, pydantic, argon2-cffi-bindings, argon2-cffi, quantcrypt
Successfully installed annotated-types-0.6.0 argon2-cffi-23.1.0 argon2-cffi-bindings-21.2.0 cffi-1.16.0 click-8.1.7 colorama-0.4.6 dotmap-1.3.30 markdown-it-py-3.0.0 mdurl-0.1.2 orjson-3.9.13 pycparser-2.21 pycryptodomex-3.20.0 pydantic-2.6.0 pydantic-core-2.16.1 pygments-2.17.2 quantcrypt-0.3.4 rich-13.7.0 shellingham-1.5.4 typer-0.9.0 types-zxcvbn-4.4.1.20240106 typing-extensions-4.9.0 zxcvbn-4.4.28
(qctest-312) C:\Users\jinna\qckey\test>qclib
Usage: qclib [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ --version -v Print the package version to console and exit. ││ --info -i Print package info to console and exit. ││ --install-completion Install completion for the current shell. ││ --show-completion Show completion for the current shell, to copy it or customize the installation. ││ --help Show this message and exit. │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────╮│ decrypt Uses an ASCII armored KEM secret key to decrypt a file with the Krypton cipher. ││ encrypt Uses an ASCII armored KEM public key to encrypt a file with the Krypton cipher. ││ keygen Generates an ASCII armored keypair using a KEM or a DSS algorithm. ││ optimize Removes those PQA binaries which are incompatible with your platform. ││ sign Uses an ASCII armored DSS secret key to generate a signature for a file. ││ verify Uses an ASCII armored DSS public key to verify the signature of a file. │╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
(qctest-312) C:\Users\jinna\qckey\test>qclib keygen kyber
QuantCrypt is about to generate kyber-pubkey.qc and kyber-seckey.qc files
into the following directory: C:\Users\jinna\qckey\test
Do you want to continue? [y/n]: y
✔ Operation successful!
The precompiled package cannot be used and must be compiled manually to use it.