Lightweight Python CLI for key generation, signing, and verification using
dilithium-py (Dilithium + ML-DSA variants).
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtGenerate private key (private container stores both sk and pk):
python3 -m crypto_py.cli generate --algorithm dil2 --out key.pemExtract public key:
python3 -m crypto_py.cli public --in key.pem --out pub.pemSign file:
python3 -m crypto_py.cli sign --sec key.pem --file ./test.txt --out signature.binVerify signature:
python3 -m crypto_py.cli verify --pub pub.pem --sig signature.bin --file ./test.txtdil2dil3dil5mldsa44mldsa65mldsa87
- Key I/O supports
PEMandDER. - Default format is
PEMfor both input and output. --outform DERwrites binary DER instead of PEM.
Examples:
python3 -m crypto_py.cli generate --algorithm mldsa44 --out key.der --outform DER
python3 -m crypto_py.cli public --in key.der --inform DER --out pub.der --outform DERgenerate
- Required:
--algorithm - Optional:
--out,--outform {PEM,DER}
public
- Required:
--in - Optional:
--inform {PEM,DER},--out,--outform {PEM,DER}
sign
- Required:
--sec,--file - Optional:
--inform {PEM,DER},--out
verify
- Required:
--pub,--sig,--file - Optional:
--inform {PEM,DER}
- If
--outis omitted (generate,public,sign), output is written tostdout. verifyprintsVerification: TrueorVerification: False.- Process exit code:
0on success1on verification failure or runtime error
- The project uses custom key containers with PEM labels:
CRYPTO-PY PRIVATE KEYCRYPTO-PY PUBLIC KEY